Skip to content

Fix TypeError with empty axes in FFT functions#288

Merged
antonwolfy merged 5 commits intomasterfrom
fix-error-on-empty-axes
Mar 13, 2026
Merged

Fix TypeError with empty axes in FFT functions#288
antonwolfy merged 5 commits intomasterfrom
fix-error-on-empty-axes

Conversation

@antonwolfy
Copy link
Collaborator

@antonwolfy antonwolfy commented Mar 12, 2026

This PR fixes "copyto() argument 1 must be a numpy.ndarray" error, like:

deploy/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_place/lib/python3.13/site-packages/mkl_fft/_fft_utils.py", line 250, in _iter_complementary
    np.copyto(result[tuple(sl)], func(x[tuple(sl)], **kwargs))
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: copyto() argument 1 must be a numpy.ndarray, not numpy.complex128

when calling FFT functions with axes=().

Thus the PR adds a fast path to handle empty axes as identity transform, matching NumPy behavior.

The issue was introduced in scope of #283. The tests coverage is improved.

@antonwolfy antonwolfy added this to the 2.2.0 release milestone Mar 12, 2026
@antonwolfy antonwolfy self-assigned this Mar 12, 2026
@antonwolfy antonwolfy marked this pull request as ready for review March 12, 2026 18:02
Copy link
Contributor

@jharlow-intel jharlow-intel left a comment

Choose a reason for hiding this comment

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

linux validation failure is due to bdba server outage, nothing to do with this PR.

LGTM, thanks for adding the new test cases, too

Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

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

other than previous comment LGTM

@antonwolfy antonwolfy merged commit 57c67a5 into master Mar 13, 2026
86 checks passed
@antonwolfy antonwolfy deleted the fix-error-on-empty-axes branch March 13, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants