Solved by MariosOreo in post #2 
              
              
                Hello, 
.clone() is not a shared memory operation. 
In the first for loop, you clone the conv1.weight to orig_params, here conv1.weight and p point to the same memory, and orig_params points to another memory. 
Then changing the value of p and conv1.weight together, because they are sharing the same…