Most efficient way to use Column major when reshape a 1D array in PyTorch
import torch

    p = torch.arange(0, 12, requires_grad=False, dtype=torch.int32)
    pr = torch.reshape(p, (4, 3))


what I want is
pr = [0 4 8 
      1 5 9
      2 6 10
      3 7 11]

but it actually becomes
pr = [0 1 2 
      3 4 5
      6 7 8
      9 10 11]

I search online it said permute can do it, but it will make a copy of your array, what is the most efficient way to reshape it in PyTorch?

You are close but to get what you want you have to rearrange it a little bit.
import torch

p = torch.arange(0, 12, requires_grad=False, dtype=torch.int32)
pr = torch.reshape(p, (3, 4)).t()

pr
Out[49]: 
tensor([[ 0,  4,  8],
        [ 1,  5,  9],
        [ 2,  6, 10],
        [ 3,  7, 11]], dtype=torch.int32)

