These operations should create a non-leaf parameter, and the .grad attribute would disappear.
In the end you’ve replaced the original parameter which was used to compute the output activation, so that the backward pass won’t be able to compute the valid gradients anymore, no?
Could you explain your use case a bit?