.reshape or .view() tensor

for example,
how to convert 1x32 1d torch tensor [1,2,3,4,5,6,7,8,9,10,11,12, …, 30,31,32] to (2x2)x(4x2) 2d array [[[1,2],[3,4]],[[5,6],[7,8]],[[9,10],[11,12]], … [[29,30],[31,32]]] without using for loop. this doesn’t work with [tensor].view(22, 42).

But [[[1,2],[3,4]],[[5,6],[7,8]],[[9,10],[11,12]], … [[29,30],[31,32]]] is not a 2D array.

Try: [tensor].view(8, 2, 2) for that.