I have an array y that is of shape (m, n) and an array indices that is of shape (m, n, k). Suppose I want to do the following (in Python):
x = np.ndarray(shape=(m,n,k))
for i in range(m):
for j in range(n):
for l in range(k):
x[i,j,l] = y[indices[i,j,l],j]
Is there a way to do this simply using NumPy that doesn't require using for loops?