import numpy as np a = np.array([[[[1, 1], [2, 2]], [[3, 3], [4, 4]]], [[[5, 5], [6, 6]], [[7, 7], [8, 8]]]]) a.shape # (2, 2, 2, 2) b = a[0, :, :, 0] b.shape # (2, 2) c = a[0:1, :, :, 0:1] c.shape # (1, 2, 2, 1)
(edited):
の次元は残して、インデックス指定してる次元での断面を求めてるイメージ (edited)>>> print(b) [[1 2] [3 4]] >>> print(c) [[[[1] [2]] [[3] [4]]]]