I have a question with regards to reproducibility of results in PyTorch. In my main file (
trainer.py file), I am doing the following:
torch.cuda.manual_seed(seed_val) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False
I am doing this ensure that my results match atleast upto some precision across different runs.
So my question is, do I have to write these 3 lines in all my files which import pytorch, for example my file where I have defined the neural network model, or maybe file where I have defined my loss function, the data loader files and so on, or is it enough to include these 3 lines ONLY in my
trainer.py, where I am instantiating (and initializing), the loss function, the NN model, and other stuff?
Please help me out.