How do I reshape this tensor?
I have a torch.tensor that looks like this:

tensor([[[A,B,C],
         [D,E,F],
         [G,H,I]],

        [[J,K,L],
         [M,N,O],
         [P,Q,R]]]


I want to reshape this tensor so that its dimensions are (18, 1). I want the new tensor to look like this:

tensor([A,
        J,
        B,
        K,
        C,
        L,
        D,
        M,
       ...
        I,
        R])


I've tried tensor.view(-1,1) but this doesn't work..

a = torch.arange(18).view(2,3,3)

print(a)
#tensor([[[ 0,  1,  2],
#         [ 3,  4,  5],
#         [ 6,  7,  8]],
#
#        [[ 9, 10, 11],
#         [12, 13, 14],
#         [15, 16, 17]]])

aa = a.permute(1,2,0).flatten()

print(aa)
#tensor([ 0,  9,  1, 10,  2, 11,  3, 12,  4, 13,  5, 14,  6, 15,  7, 16,  8, 17])

