mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-09-10 03:25:22 +00:00
Add a LatentConcat node. (#9587)
This commit is contained in:
@@ -105,6 +105,38 @@ class LatentInterpolate:
|
|||||||
samples_out["samples"] = st * (m1 * ratio + m2 * (1.0 - ratio))
|
samples_out["samples"] = st * (m1 * ratio + m2 * (1.0 - ratio))
|
||||||
return (samples_out,)
|
return (samples_out,)
|
||||||
|
|
||||||
|
class LatentConcat:
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(s):
|
||||||
|
return {"required": { "samples1": ("LATENT",), "samples2": ("LATENT",), "dim": (["x", "-x", "y", "-y", "t", "-t"], )}}
|
||||||
|
|
||||||
|
RETURN_TYPES = ("LATENT",)
|
||||||
|
FUNCTION = "op"
|
||||||
|
|
||||||
|
CATEGORY = "latent/advanced"
|
||||||
|
|
||||||
|
def op(self, samples1, samples2, dim):
|
||||||
|
samples_out = samples1.copy()
|
||||||
|
|
||||||
|
s1 = samples1["samples"]
|
||||||
|
s2 = samples2["samples"]
|
||||||
|
s2 = comfy.utils.repeat_to_batch_size(s2, s1.shape[0])
|
||||||
|
|
||||||
|
if "-" in dim:
|
||||||
|
c = (s2, s1)
|
||||||
|
else:
|
||||||
|
c = (s1, s2)
|
||||||
|
|
||||||
|
if "x" in dim:
|
||||||
|
dim = -1
|
||||||
|
elif "y" in dim:
|
||||||
|
dim = -2
|
||||||
|
elif "t" in dim:
|
||||||
|
dim = -3
|
||||||
|
|
||||||
|
samples_out["samples"] = torch.cat(c, dim=dim)
|
||||||
|
return (samples_out,)
|
||||||
|
|
||||||
class LatentBatch:
|
class LatentBatch:
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
@@ -279,6 +311,7 @@ NODE_CLASS_MAPPINGS = {
|
|||||||
"LatentSubtract": LatentSubtract,
|
"LatentSubtract": LatentSubtract,
|
||||||
"LatentMultiply": LatentMultiply,
|
"LatentMultiply": LatentMultiply,
|
||||||
"LatentInterpolate": LatentInterpolate,
|
"LatentInterpolate": LatentInterpolate,
|
||||||
|
"LatentConcat": LatentConcat,
|
||||||
"LatentBatch": LatentBatch,
|
"LatentBatch": LatentBatch,
|
||||||
"LatentBatchSeedBehavior": LatentBatchSeedBehavior,
|
"LatentBatchSeedBehavior": LatentBatchSeedBehavior,
|
||||||
"LatentApplyOperation": LatentApplyOperation,
|
"LatentApplyOperation": LatentApplyOperation,
|
||||||
|
Reference in New Issue
Block a user