When to focus the deep_copy?

when I use the code: b = a[i, :], I find that when b changed and a change too, but in most time it should not in this situations. I can not figure out the difference. Note that a is a tensor.

In your example a and b share the underlying data. If you would like to copy the data, you can call .clone() on a.