Skip to content

Commit ad53e78

Browse files
authored
Fix Noise_EmptyNoise when using nested latents (#12089)
1 parent 29011ba commit ad53e78

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

comfy_extras/nodes_custom_sampler.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,14 @@ def __init__(self):
701701

702702
def generate_noise(self, input_latent):
703703
latent_image = input_latent["samples"]
704-
return torch.zeros(latent_image.shape, dtype=latent_image.dtype, layout=latent_image.layout, device="cpu")
704+
if latent_image.is_nested:
705+
tensors = latent_image.unbind()
706+
zeros = []
707+
for t in tensors:
708+
zeros.append(torch.zeros(t.shape, dtype=t.dtype, layout=t.layout, device="cpu"))
709+
return comfy.nested_tensor.NestedTensor(zeros)
710+
else:
711+
return torch.zeros(latent_image.shape, dtype=latent_image.dtype, layout=latent_image.layout, device="cpu")
705712

706713

707714
class Noise_RandomNoise:

0 commit comments

Comments
 (0)