Add norm parameter to FFT transforms (backward/ortho/forward)#3287
Merged
zcbenz merged 5 commits intoml-explore:mainfrom Mar 25, 2026
Merged
Add norm parameter to FFT transforms (backward/ortho/forward)#3287zcbenz merged 5 commits intoml-explore:mainfrom
zcbenz merged 5 commits intoml-explore:mainfrom
Conversation
zcbenz
requested changes
Mar 23, 2026
Collaborator
zcbenz
left a comment
There was a problem hiding this comment.
The StreamOrDevice parameter should always be put last.
bfb285a to
a6631d6
Compare
Contributor
Author
Moved StreamOrDevice to last across all FFT APIs and call sites. |
a6631d6 to
8d4aeae
Compare
zcbenz
approved these changes
Mar 23, 2026
Collaborator
zcbenz
left a comment
There was a problem hiding this comment.
Thanks for the contributions! This basically looks good to me, just a few more small requests.
…emove uint8_t Co-authored-by: Cheng <git@zcbenz.com>
Contributor
Author
|
The test_vmap_masked_scatter failure appears unrelated to this PR, |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed changes
Adds
normsupport ("backward","ortho","forward") to FFT transforms for NumPy parity.Matches NumPy
numpy.fftnorm conventions and addresses the normalization scaling gap noted in themlx/primitives.cppFFT VJP TODO.FFTNormto core FFT API and threads it throughfft/ifft/rfft/irfft,fft2/ifft2/rfft2/irfft2,fftn/ifftn/rfftn/irfftnmlx/fft.cpp:"backward": existing behavior (default)"ortho":1/sqrt(N)forward,sqrt(N)inverse adjustment"forward":1/Nforward,Ninverse adjustmentnorm="backward"parameter for all 12 FFT APIs with input validationDefault behavior is unchanged (
norm="backward").Checklist
pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes