-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
np.repeat not accepting np.uint for repeats #15965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think this is by design, things like indices / strides / repeat numbers are expected to be of type Performing the cast yourself with a less strict casting rule (such as |
I can't comment on Python/Numpy design preferences, I just thought I already used Feel free to close this issue. |
You should never use Internally, numpy has chosen to use I don't want to close this issue just yet, I agree your use-case is fairly reasonable.
Right, but you wouldn't actually get an efficiency gain here because instead we'd need to perform a check that all values are less than |
In most of these places we do use same kind casting. That is arguably incorrect of course, but unfortunately not being able to index e.g. with a uint64 would be strange as well. The only fix would be to have a whole code path(s) around bounds-checking for different integer types. |
Repeat only accepts int or int array for repeats, np.uint is not accepted. But the function still checks if repeats are negative. I am working with nonegative values this becomes an unnecessary conversion step.
Reproducing code example:
Error message:
Numpy/Python version information:
The text was updated successfully, but these errors were encountered: