You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File ~/.local64/mambaforge/envs/default/lib/python3.11/site-packages/numpy/lib/shape_base.py:170, in take_along_axis(arr, indices, axis)
167 arr_shape = arr.shape
169 # use the fancy index
--> 170 return arr[_make_along_axis_idx(arr_shape, indices, axis)]
File ~/.local64/mambaforge/envs/default/lib/python3.11/site-packages/numpy/lib/shape_base.py:32, in _make_along_axis_idx(arr_shape, indices, axis)
30 raise IndexError('`indices` must be an integer array')
31 if len(arr_shape) != indices.ndim:
---> 32 raise ValueError(
33 "`indices` and `arr` must have the same number of dimensions")
34 shape_ones = (1,) * indices.ndim
35 dest_dims = list(range(axis)) + [None] + list(range(axis+1, indices.ndim))
ValueError: `indices` and `arr` must have the same number of dimensions
but it would be nice if np.take_along_axis(x, np.argmax(x, axis=axis, keepdims=True), axis=axis) were always equal to np.max(x, axis=axis, keepdims=True)
The text was updated successfully, but these errors were encountered:
Proposed new feature or change:
Consider the code
They both give
This can be worked around by using
but it would be nice if
np.take_along_axis(x, np.argmax(x, axis=axis, keepdims=True), axis=axis)
were always equal tonp.max(x, axis=axis, keepdims=True)
The text was updated successfully, but these errors were encountered: