-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Deprecate old fft functions #44876
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
Deprecate old fft functions #44876
Conversation
[ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit cd37267 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 55 times. |
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
ghstack-source-id: 21b330d Pull Request resolved: pytorch#44876
[ghstack-poisoned]
[ghstack-poisoned]
aten/src/ATen/native/SpectralOps.cpp
Outdated
|
|
||
| Tensor fft(const Tensor& self, const int64_t signal_ndim, const bool normalized) { | ||
| TORCH_WARN_ONCE( | ||
| "torch.fft is deprecated and will be removed in pytorch 1.8. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing this now because I'd like to get this in for 1.7 (branch cut next week Tuesday) so torch.fft() is deprecated in 1.7 and can be removed in 1.8. Realistically this PR and the one it's stacked will need to be done and landable before Monday to make that happen. Let me know if there's something I can do to help, @peterbell10.
Overall this looks good but it needs two things:
- the _tensor_docs.py for
torch.fftalso need a (deprecation) warning with language like this (except it can link to the torch.fft module documentation) - this warning should tell people to import torch.fft to get access to the functions that are replacing
torch.fft()
Maybe something like:
"The function torch.fft is deprecated and will be removed in a future PyTorch release. Use the new torch.fft module functions, instead, by importing torch.fft and calling torch.fft.fft or torch.fft.fftn."
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mruberry I've updated the docs and warning message. Is there a policy on giving the version a deprecated function will be removed? I've put torch.fft() as expiring in 1.8 but left the others as "a furture PyTorch release" since that's not a priority.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No policy. "In a future PyTorch release" gives us some latitude.
|
|
||
| Tensor rfft(const Tensor& self, const int64_t signal_ndim, const bool normalized, | ||
| const bool onesided) { | ||
| TORCH_WARN_ONCE( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecating torch.fft() is the priority (since its name conflicts with the module), but deprecating these is OK if the same pattern is followed. I.e.:
""The function torch.rfft is deprecated and will be removed in a future PyTorch release. Use the new torch.fft module functions, instead, by importing torch.fft and calling torch.fft.rfft or torch.fft.rfftn."
And also updating the torch.rfft and torch.irfft docs.
[ghstack-poisoned]
[ghstack-poisoned]
torch/_torch_docs.py
Outdated
| .. deprecated:: 1.7.0 | ||
| The function :func:`torch.fft` is deprecated and will be removed in a | ||
| PyTorch 1.8. Use the new :mod:`torch.fft` module functions instead, by | ||
| importing :mod:`torch.fft` and calling :func:`torch.fft.fft` or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll note that torch.fft unfortunately links to the function instead of the module. I was hoping :mod: would disambiguate, but I guess it's unlikely to work properly until the function is removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Darn. I guess we can just write the url by hand for now? It's very unlikely to change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used a reference so I didn't have to hard-code the URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smart solution.
[ghstack-poisoned]
mruberry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, @peterbell10. Just a few minor corrections to be applied. Ping me when this is ready.
Differential Revision: [D23866715](https://our.internmc.facebook.com/intern/diff/D23866715) [ghstack-poisoned]
Differential Revision: [D23866715](https://our.internmc.facebook.com/intern/diff/D23866715) [ghstack-poisoned]
Differential Revision: [D23866715](https://our.internmc.facebook.com/intern/diff/D23866715) [ghstack-poisoned]
|
@mruberry I've corrected the warnings. |
torch/_torch_docs.py
Outdated
| The inverse of this function is :func:`~torch.ifft`. | ||
| .. deprecated:: 1.7.0 | ||
| The function :func:`torch.fft` is deprecated and will be removed in a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"in a PyTorch 1.8" -> "in PyTorch 1.8"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mruberry fixed.
Differential Revision: [D23866715](https://our.internmc.facebook.com/intern/diff/D23866715) [ghstack-poisoned]
Differential Revision: [D23866715](https://our.internmc.facebook.com/intern/diff/D23866715) [ghstack-poisoned]
mruberry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thanks @peterbell10!
Codecov Report
@@ Coverage Diff @@
## gh/peterbell10/11/base #44876 +/- ##
=======================================================
Coverage 68.08% 68.08%
=======================================================
Files 393 393
Lines 50765 50765
=======================================================
+ Hits 34564 34565 +1
+ Misses 16201 16200 -1
Continue to review full report at Codecov.
|
|
Note the 1.7 release notes state
however the |
The release notes are, unfortunately, incorrect. All of these functions are different from each other, as described in the Wiki article here: https://github.com/pytorch/pytorch/wiki/The-torch.fft-module-in-PyTorch-1.7. You can translate rfft and irfft calls to rfftn and irfftn calls, however. |
Stack from ghstack:
Differential Revision: D23866715