I have the following 3D array in Numpy:
a = np.array([[[1,2],[3,4]], [[5,6],[7,8]], [[9,10],[11,12]],[[13,14],[15,16]]])
when I write
b = np.reshape(a, [4,4])
The 2D resulting array will look like
[[ 1 2 3 4]
[ 5 6 7 8]
[ 9 10 11 12]
[13 14 15 16]]
However, I want it to be in this shape:
[[ 1 2 5 6]
[ 3 4 7 8]
[ 9 10 13 14]
[11 12 15 16]]
How can I do this efficiently in Python/Numpy?