You’re correct.  I’m not copying running_mean and running_var to Model B.
I am storing weights as mentioned in pytorch imagenet tutorials.
'state_dict': model.state_dict()

I wrote print statement after prec=validate(testloader, model, criterion)
print(model.trianing)

It returned false.
#2
I loaded weights to ModelA as given in Tutorials
checkpoint = torch.load('./result/Mobilenet/grad_best.pth.tar')
Dict = checkpoint['state_dict']
Model.load_state_dict(Dict)

I’m copying weights from Model A to Model B
batchnorm weights
Net.model[i][1].weight.data.copy_(Model.model[i][1].weight.data)
Net.model[i][1].bias.data.copy_(Model.model[i][1].bias.data)

Question


Does state_dict() save running statistics? If not how to save running batchnorm weights?


When I’m copying batchnorm weights layer wise using copy_ does it copy running batchnorm weights also. If not how to copy runninng batchnorm weights to Model B?