Indexation multidimensionnelle numpy
# Let's say you have a batch of 256 inputs, each one has a set of 64 points.
x.shape --> (256, 64, 3)
# Now assume you want to index each image and draw 128 samples of those points,
# with an indices matrix.
idx.shape --> (256, 128)
# Do
y = x[np.arange(x.shape[0]), idx.T].reshape((1, 0, 2))
y.shape --> (256, 128, 3)
Testy Toad