Fix Noise_EmptyNoise when using nested latents (#12089)

This commit is contained in:
Jukka Seppänen 2026-01-27 02:25:00 +02:00 committed by GitHub
parent 29011ba87e
commit ad53e78f11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -701,7 +701,14 @@ class Noise_EmptyNoise:
def generate_noise(self, input_latent): def generate_noise(self, input_latent):
latent_image = input_latent["samples"] latent_image = input_latent["samples"]
return torch.zeros(latent_image.shape, dtype=latent_image.dtype, layout=latent_image.layout, device="cpu") if latent_image.is_nested:
tensors = latent_image.unbind()
zeros = []
for t in tensors:
zeros.append(torch.zeros(t.shape, dtype=t.dtype, layout=t.layout, device="cpu"))
return comfy.nested_tensor.NestedTensor(zeros)
else:
return torch.zeros(latent_image.shape, dtype=latent_image.dtype, layout=latent_image.layout, device="cpu")
class Noise_RandomNoise: class Noise_RandomNoise: