Here’s the example:
import numpy as np
A = np.random.randint(100)
B = np.random.randint(100)
C = np.random.randint(100)
print(f"{A=}, {B=}, {C=}")
x = np.random.random((A, B, C))
print(f"{x.shape=}")
a = np.random.randint(0, A)
b = np.random.randint(0, A)
print(f"{a=}, {b=}")
c = np.random.randint(0, B)
d = np.random.randint(0, B)
print(f"{c=}, {d=}")
print(f"{x[[a, b], [c, d], :].shape}")
print(f"{x[[a, b]][:, [c, d]].shape}")
A=4, B=87, C=95
x.shape=(4, 87, 95)
a=2, b=3
c=78, d=60
(2, 95)
(2, 2, 95)
I would have expected indexing with [[a, b], [c, d], :]
to produce a shape (2, 2, C)
?