Solved by tom in post #2 
              
              
                Use stride and size to track the memory layout: 
a = torch.randn(3, 4, 5)
b = a.permute(1, 2, 0)
c = b.contiguous()
d = a.contiguous()
# a has "standard layout" (also known as C layout in numpy) descending strides, and no memory gaps (stride(i-1) == size(i)*stride(i))
print (a.shape, a.stride(), a.d…