Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import torch
- class MixLatents:
- @classmethod
- def INPUT_TYPES(s):
- return {"required": { "latent1": ("LATENT",), "latent2": ("LATENT",), "ratio": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01})}}
- RETURN_TYPES = ("LATENT",)
- FUNCTION = "mix"
- CATEGORY = "latent"
- def mix(self, latent1, latent2, ratio):
- s = latent1["samples"] * (1 - ratio) + latent2["samples"] * (ratio)
- return ({"samples":s},)
- NODE_CLASS_MAPPINGS = {
- "MixLatents": MixLatents,
- }
- NODE_DISPLAY_NAME_MAPPINGS = {
- "MixLatents": "Mix Latents",
- }
- __all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]
Advertisement
Add Comment
Please, Sign In to add comment