In pytorch, it is different to have different Tensor and have different memory.
When you do b = a.detach(), a and b are two completely different Tensors that look at the same memory.
Just like b = a.view(-1) are two different Tensors that look at the same memory.
The inplace version (that would modify the Tensor inplace) is a.detach_() or b = a.detach_(). If you do this, then a and b actually point to the exact same python object (check that id(a) == id(b)) and same Tensor.