Solved by albanD in post #4 
              
              
                Hi, 
This does not work because par = foo is assigning to the object foo the new name of par. What was in par before is deleted. 
If you want to write in the par Tensor, you need to use an inplace operation like par.copy_(foo) to copy into the Tensor that is in par. 
Also the .to() operation is alwa…