In [1]:
import numpy as np
In [2]:
a = np.arange(120).reshape(2, 3, 4, 5)
In [3]:
print(a.shape)
In [4]:
print(a[:, :, :, 0])
In [5]:
print(a[..., 0])
In [6]:
print(a[0, :, :, 0])
In [7]:
print(a[0, ..., 0])
In [8]:
print(a[Ellipsis, 0])
In [9]:
print(a[0, Ellipsis, 0])
In [10]:
# print(a[..., 0, ...])
# IndexError: an index can only have a single ellipsis ('...')
In [11]:
print(a[0, 0, :, :])
In [12]:
print(a[0, 0])
In [13]:
print(a[0, 0, ...])