How to change shape of matrix?

I want to convert a 1x6 matrix into a 2x3 matrix B and then convert it back to 1x6 C. How do I do it?

B = A.view(2, 3)
C = B.view(1, 6)


B = A.reshape(2, 3)
C = B.reshape(1, 6)
1 Like

But how to do it in batches?