I would cite @albanD in here since this is still relevant for PyTorch 4,0 and later.

  
    
    
    Clone and detach in v0.4.0 
  
  
    Hi, 
Yes, .detach() gives a new Tensor that is a view of the original one. So any inplace modification of one will affect the other. 
You should use .clone() if you want a Tensor with the same content backed with new memory. 
And .detach().clone() if you want a new Tensor backward with new memory and that does not share the autograd history of the original one.