Skip to content

Fix HFFT tests to use complex input tensors#1533

Open
alinpahontu2912 wants to merge 3 commits intomainfrom
fix-hfft-real-input-test
Open

Fix HFFT tests to use complex input tensors#1533
alinpahontu2912 wants to merge 3 commits intomainfrom
fix-hfft-real-input-test

Conversation

@alinpahontu2912
Copy link
Member

PyTorch's fft.hfft/hfft2/hfftn require complex input tensors. The tests were passing real-valued tensors (Float32/Float64), which causes 'NYI' errors in newer PyTorch versions. Fixed by using complex64/complex128 input types and ihfft for inverse verification.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the HFFT test suite to use complex input tensors as required by PyTorch's hfft/hfft2/hfftn functions. These functions expect Hermitian symmetric complex inputs and produce real-valued outputs. The tests were incorrectly using real-valued Float32/Float64 input tensors, which causes 'NYI' (Not Yet Implemented) errors in newer PyTorch versions.

Changes:

  • Updated input tensor creation in HFFT tests to use complex64/complex128 instead of Float32/Float64 scalar types
  • Changed inverse verification from ifft to ihfft (the correct inverse of hfft)
  • Fixed output dtype assertions to explicitly check for Float32/Float64 instead of comparing with input dtype

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@alinpahontu2912
Copy link
Member Author

@copilot fix the comment

Copy link

Copilot AI commented Feb 17, 2026

@alinpahontu2912 I've opened a new pull request, #1539, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

alinpahontu2912 and others added 3 commits March 4, 2026 10:41
PyTorch's fft.hfft/hfft2/hfftn require complex input tensors.
The tests were passing real-valued tensors (Float32/Float64), which
causes 'NYI' errors in newer PyTorch versions. Fixed by using
complex64/complex128 input types and ihfft for inverse verification.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The test method was incorrectly calling fft.hfft2() instead of fft.hfftn(),
and using ihfft2() instead of ihfftn() for verification. Updated the TestOf
attribute to match the correct function being tested.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Removed Float32HFFT and Float64HFFT as they were duplicates of ComplexFloat versions.

Renamed Float32HFFT2/N and Float64HFFT2/N to ComplexFloat... to reflect input type.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@alinpahontu2912 alinpahontu2912 force-pushed the fix-hfft-real-input-test branch from 74e9189 to f3bab3e Compare March 4, 2026 08:41
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