Solved by ayalaa2 in post #2 
              
              
                This works, but it’s not my preferred method. 
torch.manual_seed(0) sets the state of the global seed generator. So this will cause all subsequent calls that uses any kind of torch randomness to be reproducible. However, suppose you refactored your code later on: 
torch.manual_seed(0)

# Adding anot…