I started with an mxnxp array, A,
mxnxp
A
In [16]: A Out[16]: array([[[ 2.10000000e+01, 3.70060693e-01], [ 2.00000000e+01, 2
You could use numpy.squeeze()
x = np.array([[[0], [1], [2]]]) x.shape (1, 3, 1) np.squeeze(x).shape (3,) np.squeeze(x, axis=(2,)).shape (1, 3)