I have a 3D
matrix in python as the following:
import numpy as np
a = np.ones((2,2,3))
a[0,0,0] = 2
a[0,0,1] = 3
a[0,0,2] = 4
I want to convert this 3D
matrix to a set of 2D
matrices. I have tried np.reshape
but it did not solve my problem. The final shape I am interested in is the following cascaded vesrsion:
[[ 2. 1. 3. 1. 4. 1.]
[ 1. 1. 1. 1. 1. 1.]]
However, np.reshape
gives me the following
[[ 2. 3. 4. 1. 1. 1.]
[ 1. 1. 1. 1. 1. 1.]]
How can I solve this?