Update rng.py

This commit is contained in:
lllyasviel
2024-02-05 13:33:27 -08:00
parent 0ba407fd9c
commit f5b3fcc6cf

View File

@@ -10,6 +10,11 @@ def randn(seed, shape, generator=None):
manual_seed(seed)
if generator is not None:
# if generator is not none, we must generate a noise with and without
# generator together to avoid future 'randn_like' get same noise again
torch.randn(shape, device=devices.device)
if shared.opts.randn_source == "NV":
return torch.asarray((generator or nv_rng).randn(shape), device=devices.device)