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.