Set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes

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():
it prints “None”.
What’s the problem with it? Did these two problems have relationship?

you will have to first run an input through the network before printing param.grad i think.

Can you give a small script to reproduce what you are talking about.

I also have the same problem, has a solution been found ?

has this been solved? What is going on and what should we do?

@ptrblck @smth can you explain torch.nn.Module.dump_patches = True or provide a link on the official doc? I could not find any understandable information

You can find some information of its usage here. I haven’t used it yet, so I cannot provide more information.

I also encountered the same problem,Have you solved it?

I changed type of serialization and I try to save arch along with a state_dict. So, I avoid problem with dump_patches.