I checked the id of x and y in your example, although they have different ids, but when I compare them the result show they’re the same.
x = torch.arange(12).view(4, 3)
y=x.t()
y = y.contiguous()
print(id(x.storage()))
print(id(y.storage()))
print(id(x.storage())==id(y.storage()))
> 4495471152
> 4495376464
> True

Then I further check each element in x and y manually, and I found the id of same element in x and y is identical. For example:
id(x.storage()[0])
> 4336047184
id(y.storage()[0])
> 4336047184
id(x.storage()[3]) # x.storage()[3] == 3 
> 4336047280
id(y.storage()[1])  # y.storage()[1] == 3 
> 4336047280

It to me seems like the contiguous doesn’t create a copy of the memory, but create a new “reference” to the same memory. Since I don’t know much about memory management, I would like to know if my guess is to some extent right.
Thank you in advance.