Strides, contiguity and shared memory
A transpose changes strides, not the storage order. Spanish: strides, contigüidad.
For the contiguous np.arange(24).reshape(2, 3, 4) split into 2 heads, the result shares memory with the input and is not C-contiguous: its strides are (12, 2, 4, 1) elements. np.ascontiguousarray packs it into a fresh copy. A transpose is not always non-contiguous: a (1, 1, 4) input with one head stays contiguous.
In PyTorch, .permute gives a non-contiguous tensor. Call .contiguous() before an incompatible .view(); .reshape() copies instead, when it must.