-
Notifications
You must be signed in to change notification settings - Fork 28
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
BUG: cp.generic is an alias for np.generic #207
Conversation
2267e0e
to
5b2b3b4
Compare
This PR is ready to be reviewed and merged.
|
What would be a scenario where cupy aliasing array scalars matters? I just tried running https://github.com/data-apis/array-api-compat/blob/main/test_cupy.sh locally, and it passes with or without. |
Not that I'm aware of. To me this looks like a copy-paste error from |
So if there's no use case, what are the reasons for this then? |
5b2b3b4
to
8b53a7e
Compare
There is no use case that I know of where |
This is ready for final review and merge. |
That's bad indeed if that happens, but... does it?
This is on main, after
What am I missing? |
You're missing cupy in In [1]: from array_api_compat import is_cupy_array
In [2]: import numpy as np
In [3]: g = np.asarray([0])[0]
In [4]: is_cupy_array(g)
Out[4]: False
In [5]: import cupy
In [6]: is_cupy_array(g)
Out[6]: True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouf, yes indeed, is_cupy_array(....)
is False unless cupy
has been imported. So yes, a clear bug with a clear fix. Thank you @crusaderky
Fix bug where plain numpy objects e.g. np.int64(0) would take cupy-specific code paths.
This is a blocker for implementing
at
function in array-api-extra.