Guest User

Untitled

a guest
Sep 6th, 2025
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. if args.fixed_noise:
  2. b, c, h, w = latents.shape
  3. noises = []
  4. for i in range(b):
  5. latent_bytes = latents[i].detach().to(torch.float32).cpu().numpy().tobytes()
  6. hash_int = int(hashlib.sha256(latent_bytes).hexdigest(), 16) % (2**32)
  7. g = torch.Generator(device=latents.device).manual_seed(hash_int)
  8. noise_i = torch.randn((c, h, w), generator=g, device=latents.device)
  9. noises.append(noise_i)
  10. noise = torch.stack(noises, dim=0)
  11. else:
  12. noise = torch.randn_like(latents)
Advertisement
Add Comment
Please, Sign In to add comment