Sorry to open this up again, but I have some remaining questions. It is not exactly clear to me, why the following does not work independently of what the surrounding code would be:
# Set a deterministic random seed
torch.manual_seed(2019)

# Pregenerate the sequence of random numbers and wrap in generator
noise_generator = (t for t in torch.randn(10))

I would expect this code snippet to produce the same result regardless of what code surrounds it. Why is that not the case?
I assume that the solution would involve using torch.set_rng_state(state) instead of torch.manual_seed(2019). How can I generate a valid state from an integer seed?