Numpy multidimensional indexing for np.ufunc.at and np.ix_
问题 I would like to know how I can take index from an array and multiply with another array. I have two 4d arrays and one 2d index array: base = np.ones((2, 3, 5, 5)) to_multiply = np.arange(120).reshape(2, 3, 4, 5) index = np.array([[0, 2, 4, 2], [0, 3, 3, 2]]) The row index of the index array corresponds to the 1st dimension of base and to_multiply, and the value of the index array corresponds to the 3rd dimension of base. I want to take the slice from base according to the index and multiply