Guest User

Untitled

a guest
Jun 24th, 2024
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import torch
  2.  
  3. class MixLatents:
  4. @classmethod
  5. def INPUT_TYPES(s):
  6. return {"required": { "latent1": ("LATENT",), "latent2": ("LATENT",), "ratio": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01})}}
  7.  
  8. RETURN_TYPES = ("LATENT",)
  9. FUNCTION = "mix"
  10.  
  11. CATEGORY = "latent"
  12.  
  13. def mix(self, latent1, latent2, ratio):
  14. s = latent1["samples"] * (1 - ratio) + latent2["samples"] * (ratio)
  15. return ({"samples":s},)
  16.  
  17. NODE_CLASS_MAPPINGS = {
  18. "MixLatents": MixLatents,
  19. }
  20.  
  21. NODE_DISPLAY_NAME_MAPPINGS = {
  22. "MixLatents": "Mix Latents",
  23. }
  24.  
  25. __all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]
Advertisement
Add Comment
Please, Sign In to add comment