COMFYUI-CUSTOM-NODES / comfy_mtb /nodes /latent_processing.py
crystantine's picture
Upload 67 files
821e6d6
import torch
class LatentLerp:
"""Linear interpolation (blend) between two latent vectors"""
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"A": ("LATENT",),
"B": ("LATENT",),
"t": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.01}),
}
}
RETURN_TYPES = ("LATENT",)
FUNCTION = "lerp_latent"
CATEGORY = "mtb/latent"
def lerp_latent(self, A, B, t):
a = A.copy()
b = B.copy()
torch.lerp(a["samples"], b["samples"], t, out=a["samples"])
return (a,)
__nodes__ = [
LatentLerp,
]