8000 istft: require complex input by peterbell10 · Pull Request #86628 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

istft: require complex input #86628

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

Closed
wants to merge 5 commits into from

Conversation

peterbell10
Copy link
Collaborator
@peterbell10 peterbell10 commented Oct 10, 2022

Stack from ghstack (oldest at bottom):

Real dtype input to torch.istft has been deprecated since PyTorch
1.8, so it is more than passed its due date to be removed.

BC-breaking message:

torch.istft no longer supports input in the form of real tensors
with shape (..., 2) to mimic complex tensors. Instead, convert
inputs to a complex tensor first before calling torch.istft.

1.13

>>> t = torch.rand(65, 33, 2)
>>> _ = torch.istft(t, n_fft=128, length=1024)

2.0

>>> t = torch.rand(65, 33, 2)
>>> t_complex = torch.view_as_complex(t)
>>> _ = torch.istft(t_complex, n_fft=128, length=1024)

For `stft` this makes all cases where `return_complex` default to
`False` into an error and adds a warning when `return_complex=False`
is passed explicitly.

For `istft` this raises an error if the input is not a complex tensor.

[ghstack-poisoned]
@pytorch-bot
Copy link
pytorch-bot bot commented Oct 10, 2022

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/86628

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Merge Blocking SEVs

There is 1 active merge blocking SEVs. Please view them below:

If you must merge, use @pytorchbot merge -f.

✅ No Failures, 1 Pending

As of commit bdbad36:
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

peterbell10 added a commit that referenced this pull request Oct 10, 2022
For `stft` this makes all cases where `return_complex` default to
`False` into an error and adds a warning when `return_complex=False`
is passed explicitly.

For `istft` this raises an error if the input is not a complex tensor.

ghstack-source-id: 539c4aa
Pull Request resolved: #86628
Real dtype input to `torch.istft` has been deprecated since PyTorch
1.8, so it is more than passed its due date to be removed.

BC-breaking note:
`torch.istft` no longer supports input in the form of real tensors
with shape `(..., 2)` to mimic complex tensors. Instead, convert
inputs to a complex tensor first before calling `torch.istft`.

[ghstack-poisoned]
@peterbell10 peterbell10 changed the title stft: move towards always returning complex istft: require complex input Oct 11, 2022
peterbell10 added a commit that referenced this pull request Oct 11, 2022
Real dtype input to `torch.istft` has been deprecated since PyTorch
1.8, so it is more than passed its due date to be removed.

BC-breaking note:
`torch.istft` no longer supports input in the form of real tensors
with shape `(..., 2)` to mimic complex tensors. Instead, convert
inputs to a complex tensor first before calling `torch.istft`.

ghstack-source-id: 0970c2e
Pull Request resolved: #86628
@peterbell10 peterbell10 added module: fft release notes: python_frontend python frontend release notes category topic: bc breaking topic category labels Oct 13, 2022
@peterbell10 peterbell10 marked this pull request as ready for review October 13, 2022 15:09
Real dtype input to `torch.istft` has been deprecated since PyTorch
1.8, so it is more than passed its due date to be removed.

BC-breaking message:

`torch.istft` no longer supports input in the form of real tensors
with shape `(..., 2)` to mimic complex tensors. Instead, convert
inputs to a complex tensor first before calling `torch.istft`.

[ghstack-poisoned]
Real dtype input to `torch.istft` has been deprecated since PyTorch
1.8, so it is more than passed its due date to be removed.

BC-breaking message:

`torch.istft` no longer supports input in the form of real tensors
with shape `(..., 2)` to mimic complex tensors. Instead, convert
inputs to a complex tensor first before calling `torch.istft`.

[ghstack-poisoned]
peterbell10 added a commit that referenced this pull request Oct 16, 2022
Real dtype input to `torch.istft` has been deprecated since PyTorch
1.8, so it is more than passed its due date to be removed.

BC-breaking note:
`torch.istft` no longer supports input in the form of real tensors
with shape `(..., 2)` to mimic complex tensors. Instead, convert
inputs to a complex tensor first before calling `torch.istft`.

ghstack-source-id: b0e8dfe
Pull Request resolved: #86628
@@ -44,6 +44,14 @@
not has_scipy_fft or LooseVersion(scipy.__version__) >= '1.6.0')
else (None, "ortho"))

def _complex_from_float_dtype(real_dtype):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use this function:

def corresponding_complex_dtype(dtype: torch.dtype) -> torch.dtype:

where the ``channel`` dimension is optional.

.. versionchanged:: 1.14.0
Real input is no longer supported. Input must be complex, as returned by
Copy link
Collaborator

Choose a reason for hiding this comment

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

"Real-valued inputs are no longer supported. Input must now have a complex datatype, ..."

Copy link
Collaborator
@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

Cool! A couple small nits inline for your review

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 17, 2022
peterbell10 added a commit to peterbell10/pytorch that referenced this pull request Oct 17, 2022
Real dtype input to `torch.istft` has been deprecated since PyTorch
1.8, so it is more than passed its due date to be removed.

BC-breaking note:
`torch.istft` no longer supports input in the form of real tensors
with shape `(..., 2)` to mimic complex tensors. Instead, convert
inputs to a complex tensor first before calling `torch.istft`.

ghstack-source-id: b0e8dfe
Pull Request resolved: pytorch#86628
Real dtype input to `torch.istft` has been deprecated since PyTorch
1.8, so it is more than passed its due date to be removed.

BC-breaking message:

`torch.istft` no longer supports input in the form of real tensors
with shape `(..., 2)` to mimic complex tensors. Instead, convert
inputs to a complex tensor first before calling `torch.istft`.

[ghstack-poisoned]
peterbell10 added a commit that referenced this pull request Oct 17, 2022
Real dtype input to `torch.istft` has been deprecated since PyTorch
1.8, so it is more than passed its due date to be removed.

BC-breaking note:
`torch.istft` no longer supports input in the form of real tensors
with shape `(..., 2)` to mimic complex tensors. Instead, convert
inputs to a complex tensor first before calling `torch.istft`.

ghstack-source-id: 90d6773
Pull Request resolved: #86628
@peterbell10
Copy link
Collaborator Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request Merged module: fft open source release notes: python_frontend python frontend release notes category topic: bc breaking topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0