Can anyone explain why the results below are different? In one case I specify :2
which should be equivalent to [0,1]
, but it is unexpectedly not.
x = np.array([[[1,2,3],[4,5,6],[7,8,9]]])
array([[[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]])
x.shape
(1, 3, 3)
# Works as expected
x[0, :, :2]
array([[1, 2],
[4, 5],
[7, 8]])
# Not as expected, the results got transposed
x[0, :, [0,1]]
array([[1, 4, 7],
[2, 5, 8]])