Skip to content

Wrap fft for dask #139

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

Merged
merged 22 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/array-api-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe array-api-tests is using a typing feature (|) from Python 3.10, which is causing us to fail here.

Not sure if it's worth patching there, as NEP29 says 3.9 should be dropped anyways.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be fixed upstream now. Let's keep 3.9 support for now. We should discuss dropping Python support in another issue. I'd prefer to be as conservative as possible with supported Python versions (i.e., not drop support unless we really need to), to maximize compatibility for people.


steps:
- name: Checkout array-api-compat
Expand Down
29 changes: 29 additions & 0 deletions array_api_compat/dask/array/fft.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from dask.array.fft import * # noqa: F403
from numpy.fft import __all__ as fft_all

from ..common import _fft
from .._internal import get_xp

import dask.array as da

fft = get_xp(da)(_fft.fft)
ifft = get_xp(da)(_fft.ifft)
fftn = get_xp(da)(_fft.fftn)
ifftn = get_xp(da)(_fft.ifftn)
rfft = get_xp(da)(_fft.rfft)
irfft = get_xp(da)(_fft.irfft)
rfftn = get_xp(da)(_fft.rfftn)
irfftn = get_xp(da)(_fft.irfftn)
hfft = get_xp(da)(_fft.hfft)
ihfft = get_xp(da)(_fft.ihfft)
fftfreq = get_xp(da)(_fft.fftfreq)
rfftfreq = get_xp(da)(_fft.rfftfreq)
fftshift = get_xp(da)(_fft.fftshift)
ifftshift = get_xp(da)(_fft.ifftshift)

__all__ = fft_all + _fft.__all__

del get_xp
del da
del fft_all
del _fft
15 changes: 0 additions & 15 deletions dask-skips.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,2 @@
# FFT isn't conformant
array_api_tests/test_fft.py
array_api_tests/test_signatures.py::test_extension_func_signature[fft.fft]
array_api_tests/test_signatures.py::test_extension_func_signature[fft.ifft]
array_api_tests/test_signatures.py::test_extension_func_signature[fft.fftn]
array_api_tests/test_signatures.py::test_extension_func_signature[fft.ifftn]
array_api_tests/test_signatures.py::test_extension_func_signature[fft.rfft]
array_api_tests/test_signatures.py::test_extension_func_signature[fft.irfft]
array_api_tests/test_signatures.py::test_extension_func_signature[fft.rfftn]
array_api_tests/test_signatures.py::test_extension_func_signature[fft.irfftn]
array_api_tests/test_signatures.py::test_extension_func_signature[fft.hfft]
array_api_tests/test_signatures.py::test_extension_func_signature[fft.ihfft]
array_api_tests/test_signatures.py::test_extension_func_signature[fft.fftfreq]
array_api_tests/test_signatures.py::test_extension_func_signature[fft.rfftfreq]

# slow and not implemented in dask
array_api_tests/test_linalg.py::test_matrix_power
Loading