Cannot load state dict despite sizes being the same

I have the following error:

RuntimeError: While copying the parameter named loss.weight, whose dimensions in the model are torch.Size([20]) and whose dimensions in the checkpoint are torch.Size([20]).

If the sizes agree, then what can be the issue ?

Could you give some information on how you saved the parameter and if possible a small code snippet which reproduces this error?

Having same problem. Have you guys resolved the issue?