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
The numpy.s_/numpy.index_exp docs claim the following:
For any index combination, including slicing and axis insertion, a[indices] is the same as a[np.index_exp[indices]] for any array a.
However, this appears to only be completely accurate for numpy.s_, due to the weird backward compatibility logic where certain non-tuple sequences are converted to tuples. For example,
In [7]: a = np.zeros([4, 4])
In [8]: indices = [[0, 1], [2, 3]]
In [9]: a[indices].shape
Out[9]: (2,)
In [10]: a[np.s_[indices]].shape
Out[10]: (2,)
In [11]: a[np.index_exp[indices]].shape
Out[11]: (2, 2, 4)
numpy.index_exp's tuple creation doesn't reflect the backward compatibility handling. Either the docs or the behavior should be adjusted to match the other.
The text was updated successfully, but these errors were encountered:
The numpy.s_/numpy.index_exp docs claim the following:
However, this appears to only be completely accurate for numpy.s_, due to the weird backward compatibility logic where certain non-tuple sequences are converted to tuples. For example,
numpy.index_exp's tuple creation doesn't reflect the backward compatibility handling. Either the docs or the behavior should be adjusted to match the other.
The text was updated successfully, but these errors were encountered: