Solved by albanD in post #2 
              
              
                Hi, 
Your static Tensor should not have requires_grad=True I guess. 
And in that case, doing any op here will increase the memory usage as we need to save some values for the backward. 
Note that you should never use .data in general! 
Here you can use .detach() which will have similar behavior but …