Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if args.fixed_noise:
- b, c, h, w = latents.shape
- noises = []
- for i in range(b):
- latent_bytes = latents[i].detach().to(torch.float32).cpu().numpy().tobytes()
- hash_int = int(hashlib.sha256(latent_bytes).hexdigest(), 16) % (2**32)
- g = torch.Generator(device=latents.device).manual_seed(hash_int)
- noise_i = torch.randn((c, h, w), generator=g, device=latents.device)
- noises.append(noise_i)
- noise = torch.stack(noises, dim=0)
- else:
- noise = torch.randn_like(latents)
Advertisement
Add Comment
Please, Sign In to add comment