Non-reproducible results in pytorch after saving and loading the model
I am unable to reproduce my results in PyTorch after saving and loading the model whereas the in-memory model works as expected. Just for context, I am seeding my libraries, using model.eval to turn off the dropouts but still, results are not reproducible. Any suggestions if I am missing something.  Thanks in advance.

Libraries that I am using:-

import matplotlib.pyplot as plt
import torch
from torch import nn
from torch import optim
import torch.nn.functional as F
from torchvision import datasets, transforms
import numpy as np
import random


Libraries that I am seeding

manualSeed = 1
np.random.seed(manualSeed)
random.seed(manualSeed)
torch.manual_seed(manualSeed)
random.seed(manualSeed)


Below are the results on in memory and loaded model. 

In Memory model Loss : 1.596395881312668, In Memory model Accuracy : tensor(0.3989)
Loaded model Loss : 1.597083057567572, Loaded model Accuracy : tensor(0.3983)


Since the date that Szymon Maszke posted his response above (2019), a new API has been added, torch.use_deterministic_algorithms().
This new function does everything that torch.backends.cudnn.deterministic did (namely, makes CuDNN convolution operations deterministic), plus much more (makes every known normally-nondeterministic function either deterministic or throw an error if a deterministic implementation is not available). CuDNN convolution is only one of the many possible sources of nondeterminism in PyTorch, so torch.use_deterministic_algorithms() should now be used instead of the old torch.backends.cudnn.deterministic.
The link to the reproducibility documentation is still relevant. However, note that this page has been changed a fair bit since 2019.
