>>> a = torch.arange(12).reshape(2, 6)
>>> a
tensor([[ 0, 1, 2, 3, 4, 5],
[ 6, 7, 8, 9, 10, 11]])
>>> b = a[1:, :]
>>> b.storage() is a.storage()
False
但是
>>> b[0, 0] = 999
>>> b, a # both tensors are changed
(tensor([[999, 7, 8, 9, 10, 11]]),
tensor([[ 0, 1, 2, 3, 4, 5],
[999, 7, 8, 9, 10, 11]]))
存储张量数据的确切对象是什么?如何检查两个张量是否共享内存?