Skip to content

Commit 5cda8ea

Browse files
authored
Use randn_tensor to replace torch.randn (#10535)
`torch.randn` requires `generator` and `latents` on the same device, while the wrapped function `randn_tensor` does not have this issue.
1 parent 36acdd7 commit 5cda8ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/diffusers/pipelines/ltx/pipeline_ltx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ def __call__(
769769
if not self.vae.config.timestep_conditioning:
770770
timestep = None
771771
else:
772-
noise = torch.randn(latents.shape, generator=generator, device=device, dtype=latents.dtype)
772+
noise = randn_tensor(latents.shape, generator=generator, device=device, dtype=latents.dtype)
773773
if not isinstance(decode_timestep, list):
774774
decode_timestep = [decode_timestep] * batch_size
775775
if decode_noise_scale is None:

0 commit comments

Comments
 (0)