Re: [Numpy-discussion] Adding take_along_axis and put_along_axis functions

2018-05-28 Thread Stephan Hoyer
As I'm sure I stated in the GItHub discussion, I strongly support adding these functions to NumPy. This logic is non-trivial to get right and is quite broadly useful. These names also seem natural to me. On Mon, May 28, 2018 at 8:07 PM Eric Wieser wrote: > These functions provide a vectorized w

[Numpy-discussion] Adding take_along_axis and put_along_axis functions

2018-05-28 Thread Eric Wieser
These functions provide a vectorized way of using one array to look up items in another. In particular, they extend the 1d: a = np.array([4, 5, 6, 1, 2, 3]) b = np.array(["four", "five", "six", "one", "two", "three"]) i = a.argsort() b_sorted = b[i] To work for higher-dimensions: a = np.array([[