I try to validate several state dict, let’s say A and B.
At first, I do it in the following order:

net = Net()
net = net.to(device)
net = nn.DataParallel(net, device_ids = [0])
net.load_state_dict(torch.load(A))
torch.no_grad()
net.eval()
retA1 = net(input)
net = Net()
net = net.to(device)
net = nn.DataParallel(net, device_ids = [0])
net.load_state_dict(torch.load(B))
torch.no_grad()
net.eval()
retB1 = net(input)

The answer retA1 and retB1 is correct.
And I try the following order:

net = Net()
net = net.to(device)
net = nn.DataParallel(net, device_ids = [0])
net.load_state_dict(torch.load(A))
torch.no_grad()
net.eval()
retA2 = net(input)
net.load_state_dict(torch.load(B))
torch.no_grad()
net.eval()
retB2 = net(input)

retA2 is same as retA1, but retB2 is not same as retB1.
Is this behavior expected or I did something wrong?