-
Notifications
You must be signed in to change notification settings - Fork 29
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
Support the copy keyword in asarray #119
Merged
Merged
Changes from 11 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
e75ba03
Fix some internal documentation
asmeurer 41719af
Factor out the list of wrapped libraries in the tests
asmeurer f1068a3
Fix typo
asmeurer 73047a9
Add a test for the copy flag in asarray
asmeurer fa36c20
Properly test copy=None with the dtype argument
asmeurer 558e4ed
Move the asarray numpy implementation to numpy/_aliases
asmeurer 440e1c1
Update xfails
asmeurer f57ac54
Add a CuPy specific implementation for asarray
asmeurer 166c650
Update test to test that CuPy does not handle copy=False
asmeurer a194344
Update cupy buffer protocol copy test
asmeurer a1eea09
Merge branch 'main' into asarray-copy
asmeurer d84983a
Structure the copy flag in cupy.asarray better
asmeurer 11d27dd
Remove no longer correct note from docstring
asmeurer f6b5ea2
Add dask.array specific implementation of asarray()
asmeurer 7c0116c
Run the normal tests against different versions of numpy
asmeurer 4d54461
Fix workflow synatx
asmeurer d7807e1
Install everything in one pip command
asmeurer 354e007
Drop support for Python 3.8
asmeurer dfac540
Update extras_require in setup.py
asmeurer c7b5780
Fix ruff errors
asmeurer 3e1f24c
Only run numpy tests for numpy 1.21
asmeurer cee1696
Don't include "jax.numpy" in the numpy-only tests
asmeurer c58fbec
Test Python 3.12 on CI
asmeurer 2e5c759
Skip NumPy 1.21 in Python 3.12
asmeurer 04551ed
Fix bash syntax
asmeurer f7fb29f
Only run numpy specific tests for numpy=dev
asmeurer 689366a
Fix bash syntax
asmeurer c060cee
Run tests with -v
asmeurer 4112eaf
Disable other libraries too for the numpy-only tests
asmeurer b171583
Add requirements-dev.txt
asmeurer 8aa76b7
Add setuptools to requirements-dev.txt
asmeurer 7105866
Use pip for the test install
asmeurer aeb1cc4
Fix workflow syntax
asmeurer f7e724e
Try again to fix workflow syntax
asmeurer d7e8532
Keep trying to fix the workflow syntax
asmeurer fbd6e1b
Try more syntax fixes
asmeurer 6397108
Fix workflow syntax
asmeurer d0d068d
Merge branch 'main' into asarray-copy
asmeurer 764d5ab
Better job names for docs build and deploy
asmeurer d5a7cc6
Merge branch 'main' into asarray-copy
asmeurer 2dcd864
Merge branch 'asarray-copy' of github.com:asmeurer/array-api-compat i…
asmeurer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@leofang did you say at the meeting today that cupy 14 would definitely support NumPy 2.0? The meaning of copy=False changed between NumPy 1.26 and 2.0. Is it safe to add a
if cupy.__version__ >= 14
check here? If we just leave this wrapper code as it is, it will break once cupy makes the change, because the default would become the array API copy=False semantics.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.
It was TBD so here's my question: I would think like dpctl once CuPy is compliant we'd no longer need array-api-compat coverage? If so, I don't think we need a version check here, as it'd become moot anyway? WDYT?
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.
The way the compat library currently works is unconditionally wraps cupy. We could remove the wrapping once cupy is compliant but we'd need a version check to do that too.
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.
I mean, the version check could be added to, say,
__init__.py
instead of here, once we know better after which CuPy version all array-api-compat wrappers can just fall back to native CuPy without extra action (=no-ops), right? Maybe I oversimplified it?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.
If cupy is completely compliant and needs no wrappers we could do that. We're not doing that yet for numpy 2.0 but we probably should.
At any rate, I've thought of a better way to structure this code so that it won't actually break when cupy changes the meaning of
copy=False
, so this isn't actually important. I'll still need to update this to remove theNotImplementedError
forcopy=False
, but is isn't pressing to try to do it ahead of time now because I've made it so that the default behavior won't break, and that would be a new feature for cupy anyways.