-
Notifications
You must be signed in to change notification settings - Fork 72
Implement fft torchop #2141
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
justinchuby
merged 22 commits into
microsoft:main
from
bmehta001:bhamehta/implement-fft-torchop
Apr 16, 2025
Merged
Implement fft torchop #2141
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
36a700c
WIP
bmehta001 40588ce
Rm comments
bmehta001 e7190f1
Fixes
bmehta001 fc615bc
Lint
bmehta001 e1c24b1
Address lint
bmehta001 7f9fc4a
Simplify lines, fix signal_size type error
bmehta001 d58f63c
Address comments
bmehta001 6496d98
Address Justin's comment; fix shape call
bmehta001 e877530
2 functions pass tests
bmehta001 7bcaded
Merge branch 'main' into bhamehta/implement-fft-torchop
bmehta001 bc4d4ca
Lint
bmehta001 a01de3f
Change sizes for test
bmehta001 de24eeb
Fix c2r + some testing issues
bmehta001 f50a653
Fix c2r + tests
bmehta001 8a1e1ef
Lint
bmehta001 c51ebba
Rm `
bmehta001 f04585e
Update tests/function_libs/torch_lib/extra_opinfo.py
bmehta001 428f4d5
Simplify
bmehta001 4f04c9f
Add INT64 type
bmehta001 1ff49d4
Simplify bc original torchop does not support neg dims
bmehta001 51ab0d3
Merge branch 'main' into bhamehta/implement-fft-torchop
bmehta001 f2555ca
Merge branch 'main' into bhamehta/implement-fft-torchop
bmehta001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -684,24 +684,38 @@ def sample_inputs__fft_r2c(self, device, dtype, requires_grad=False, **_): | |
|
||
def sample_inputs__fft_c2r(self, device, dtype, requires_grad=False, **_): | ||
del self # Unused | ||
oned_tensor, nd_tensor = _prepare_data_for_fft_ops(device, dtype, requires_grad) | ||
|
||
real_dtype = torch.float | ||
if dtype == torch.complex128: | ||
real_dtype = torch.double | ||
oned_tensor, nd_tensor = _prepare_data_for_fft_ops(device, real_dtype, requires_grad) | ||
|
||
oned_tensor_result = oned_tensor() | ||
nd_tensor_result = nd_tensor() | ||
complex_oned_tensor = torch.ops.aten._fft_r2c.default( # pylint: disable=protected-access | ||
oned_tensor_result, [0], normalization=0, onesided=False | ||
) | ||
# for normalization in (0, 1, 2): | ||
for normalization in (0, 1, 2): | ||
# 1-D | ||
yield opinfo_core.SampleInput( | ||
oned_tensor(), dim=(0,), normalization=normalization, last_dim_size=12 | ||
complex_oned_tensor, | ||
dim=(0,), | ||
normalization=normalization, | ||
last_dim_size=31, | ||
) | ||
# N-D | ||
for dim in [ | ||
(0,), | ||
(1,), | ||
(2,), | ||
(1, 2), | ||
(0, 1), | ||
(0, 1, 2), | ||
Comment on lines
-699
to
-701
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to self: this should be added back in a follow up |
||
]: | ||
complex_nd_tensor = torch.ops.aten._fft_r2c.default( # pylint: disable=protected-access | ||
nd_tensor_result, dim, normalization=0, onesided=False | ||
) | ||
yield opinfo_core.SampleInput( | ||
nd_tensor(), dim=dim, normalization=normalization, last_dim_size=6 | ||
complex_nd_tensor, | ||
dim=dim, | ||
normalization=normalization, | ||
last_dim_size=complex_nd_tensor.shape[dim[-1]], | ||
) | ||
|
||
|
||
|
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.