When I load the model in checkpoints, it turns out:
SourceChangeWarning: source code of class ‘main.NeuralNetwork’ has changed. you can retrieve the original source code by accessing the object’s source attribute or set torch.nn.Module.dump_patches = True and use the patch tool to revert the changes.
And then the output of the network is the same for every input. After I print the parameters in network:
for param in network.parameters():
print(param.grad)
it prints “None”.
What’s the problem with it? Did these two problems have relationship?