-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
ENH: Add fft optional extension submodule to numpy.array_api #25317
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
Conversation
This should be ready for review. It's possible some of the dtype restrictions will change in the spec (see the discussion at data-apis/array-api#720 (comment)), but if that happens we can update this with another PR. |
This is based off of numpy/numpy#25317
Will need a release note. |
I think the tests are still skipped: numpy/tools/ci/array-api-skips.txt Line 37 in 6e3b923
When trying this in JAX, I found that |
I didn't realize that the array api tests are run on the numpy CI now. I've been running them manually. The dtype stuff is addressed here. The fft functions in numpy all upcast 32-bit inputs, which the spec says they shouldn't. This is addressed here by re-downcasting, but I also plan to fix this in numpy.fft itself (my understanding is that this should be straightforward once #25536 is merged). There are also some issues in the test suite itself so we may need to get those addressed before we remove the skips. |
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.
Thanks Aaron, and thanks Jake for the review. I think this is close - I think I found one mistake in dtype handling still, and the device
handling will need an update either here or in gh-25370 depending on which PR is merged first.
|
||
See its docstring for more information. | ||
""" | ||
if device not in ["cpu", None]: |
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.
Note that this will have a cross-merge conflict with gh-25370, where the 'cpu'
string is replaced with a custom object. The same applies to rfftfreq
below.
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.
This looks good to go now, thanks Aaron. In it goes.
I'll test this in SciPy with a NumPy nightly soon |
Does this mean that array-api-tests is up to scratch for |
No, the test suite still needs to be updated for data-apis/array-api#720, and also some of the shape tests are wrong. (cc @honno) At any rate, as soon as #25370 is merged the plan is to move numpy.array_api to another repo, and (presumably) delete it from this one, so I wouldn't worry too much right now about the array api CI skips for numpy.array_api. As for the main namespace fft, it is still incorrect in upcasting 32-bit inputs. I plan to fix this, but I need #25536 first, as I understand it. |
Note: we need to address a few issues upstream in the standard and the array-api-tests before this should be merged.