When I try to slice a Numpy array (3d), something unexpected occurs.
import numpy as np
x=np.array(
[ [[1., 2., 3., 4., 5.],
[6., 7., 8., 9., 0.],
[1., 2., 3., 4., 5.],
[6., 7., 8., 9., 0.]],
[ [11., 12., 13., 14., 15.],
[16., 17., 18., 19., 10.],
[11., 12., 13., 14., 15.],
[16., 17., 18., 19., 10.]],
[ [21., 22., 23., 24., 25.],
[26., 27., 28., 29., 20.],
[21., 22., 23., 24., 25.],
[26., 27., 28., 29., 20.]]]
)
print(x.shape) #(3,4,5)
print(x[:,0,[0,1,2,3,4]].shape) #(3,5) as expected
print(x[0,:,[0,1,2,3,4]].shape) #(5,4) why not (4,5)?
The latest one swap the dimension unexpectedly. Why?