import torch
a = torch.tensor([3,2,3,4])
b = a.view(2,2)
c = a.resize(2,2)
d = a.resize_(2,2)
print(id(a.storage()))
print(id(b.storage()))
print(id(c.storage()))
print(id(d.storage()))
run at first time
2356950450056
2356950450056
2356950450056
2356950450056
run at second time
2206021857352
2206301638600
2206021857352
2206301638600
Why does id change sometimes but not change sometimes, I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this. (apologies for my poor English) Thanks in advance.