Hi,
You should never user “.data” as a general rule. There is no reason for your to use it.
Also setting the .grad field is not very useful I think. You can just set it to None if you really want to reset it.
So the code I shared in my previous message will be enough. As the new parameter will not have a .grad field anyways. Nothing else should be needed.