Skip to content
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

stft: Require return_complex to be passed explicitly for real input #86724

Closed
wants to merge 3 commits into from

Conversation

peterbell10
Copy link
Collaborator

@peterbell10 peterbell10 commented Oct 11, 2022

Stack from ghstack (oldest at bottom):

This behavior has been deprecated since PyTorch 1.8 but this step of
the deprecation cycle was put on hold in #50102 waiting for JIT
upgraders functionality which doesn't seem to have panned out. I'd say
there has been more than enough of a deprecation period, so we should
just continue.

BC-breaking message:

torch.stft takes an optional return_complex parameter that
indicates whether the output should be a floating point tensor or a
complex tensor. return_complex previously defaulted to False for
real input tensors. This PR removes the default and makes
return_complex a required argument for real inputs. However, complex
inputs will continue to default to return_complex=True.

1.13

>>> a = torch.rand(1024)
>>> _ = torch.stft(a, n_fft=128)

2.0

>>> t = torch.rand(1024)
>>> _ = torch.stft(t, n_fft=128, return_complex=False)

This behavior has been deprecated since PyTorch 1.8 but this step of
the deprecation cycle was put on hold in #50102 waiting for JIT
upgraders functionality which doesn't seem to have panned out. I'd say
there has been more than enough of a deprecation period, so we should
just continue.

BC-breaking message:

`torch.stft` takes an optional `return_complex` parameter that
indicates whether the output should be a floating point tensor or a
complex tensor. `return_complex` previously defaulted to `False` for
real input tensors. This PR removes the default and makes
`return_complex` a required argument for real inputs. However, complex
inputs will continue to default to `return_complex=True`.

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 11, 2022

🔗 Helpful Links

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

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

✅ No Failures

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

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

@peterbell10 peterbell10 added module: bc-breaking Related to a BC-breaking change module: fft release notes: 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:00
y = x.stft(10, pad_mode='constant')
# with self.assertRaisesRegex(RuntimeError, 'stft requires the return_complex parameter'):
# y = x.stft(10, pad_mode='constant')
with self.assertRaisesRegex(RuntimeError, 'stft requires the return_complex parameter'):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: this could be an error input

@@ -612,6 +612,15 @@ def stft(input: Tensor, n_fft: int, hop_length: Optional[int] = None,
a real tensor with an extra last dimension for the real and
imaginary components.

.. versionchanged:: 1.14.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice directives

@@ -612,6 +612,15 @@ def stft(input: Tensor, n_fft: int, hop_length: Optional[int] = None,
a real tensor with an extra last dimension for the real and
imaginary components.

.. versionchanged:: 1.14.0
``return_complex`` is now a required argument for real inputs,
as the default is being trainsitioned to ``True``.
Copy link
Collaborator

Choose a reason for hiding this comment

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

"trainsitioned" -> "transitioned"

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.

This seems reasonable to me -- @ngimel @albanD is there someone at Meta who should sanity-check the BC implications?

@peterbell10 take a look at my questions about the docs, however -- I think they can be streamlined

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 14, 2022
Copy link
Collaborator

@albanD albanD left a comment

Choose a reason for hiding this comment

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

I think we should just land this!
Checking is so painful that it is easier to try and land it :)

If it comes back to us we can go down the rabbit hole.

peterbell10 added a commit to peterbell10/pytorch that referenced this pull request Oct 14, 2022
This behavior has been deprecated since PyTorch 1.8 but this step of
the deprecation cycle was put on hold in pytorch#50102 waiting for JIT
upgraders functionality which doesn't seem to have panned out. I'd say
there has been more than enough of a deprecation period, so we should
just continue.

BC-breaking message:

`torch.stft` takes an optional `return_complex` parameter that
indicates whether the output should be a floating point tensor or a
complex tensor. `return_complex` previously defaulted to `False` for
real input tensors. This PR removes the default and makes
`return_complex` a required argument for real inputs. However, complex
inputs will continue to default to `return_complex=True`.

ghstack-source-id: 32da297a1ffb8c438910cfd237ad20857da5c15b
Pull Request resolved: pytorch#86724
…eal input"

This behavior has been deprecated since PyTorch 1.8 but this step of
the deprecation cycle was put on hold in #50102 waiting for JIT
upgraders functionality which doesn't seem to have panned out. I'd say
there has been more than enough of a deprecation period, so we should
just continue.

BC-breaking message:

`torch.stft` takes an optional `return_complex` parameter that
indicates whether the output should be a floating point tensor or a
complex tensor. `return_complex` previously defaulted to `False` for
real input tensors. This PR removes the default and makes
`return_complex` a required argument for real inputs. However, complex
inputs will continue to default to `return_complex=True`.

[ghstack-poisoned]
peterbell10 added a commit to peterbell10/pytorch that referenced this pull request Oct 16, 2022
This behavior has been deprecated since PyTorch 1.8 but this step of
the deprecation cycle was put on hold in pytorch#50102 waiting for JIT
upgraders functionality which doesn't seem to have panned out. I'd say
there has been more than enough of a deprecation period, so we should
just continue.

BC-breaking message:

`torch.stft` takes an optional `return_complex` parameter that
indicates whether the output should be a floating point tensor or a
complex tensor. `return_complex` previously defaulted to `False` for
real input tensors. This PR removes the default and makes
`return_complex` a required argument for real inputs. However, complex
inputs will continue to default to `return_complex=True`.

ghstack-source-id: 32da297a1ffb8c438910cfd237ad20857da5c15b
Pull Request resolved: pytorch#86724
…eal input"

This behavior has been deprecated since PyTorch 1.8 but this step of
the deprecation cycle was put on hold in #50102 waiting for JIT
upgraders functionality which doesn't seem to have panned out. I'd say
there has been more than enough of a deprecation period, so we should
just continue.

BC-breaking message:

`torch.stft` takes an optional `return_complex` parameter that
indicates whether the output should be a floating point tensor or a
complex tensor. `return_complex` previously defaulted to `False` for
real input tensors. This PR removes the default and makes
`return_complex` a required argument for real inputs. However, complex
inputs will continue to default to `return_complex=True`.

[ghstack-poisoned]
@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

peterbell10 added a commit to peterbell10/pytorch that referenced this pull request Oct 17, 2022
This behavior has been deprecated since PyTorch 1.8 but this step of
the deprecation cycle was put on hold in pytorch#50102 waiting for JIT
upgraders functionality which doesn't seem to have panned out. I'd say
there has been more than enough of a deprecation period, so we should
just continue.

BC-breaking message:

`torch.stft` takes an optional `return_complex` parameter that
indicates whether the output should be a floating point tensor or a
complex tensor. `return_complex` previously defaulted to `False` for
real input tensors. This PR removes the default and makes
`return_complex` a required argument for real inputs. However, complex
inputs will continue to default to `return_complex=True`.

ghstack-source-id: fba3d911016009d7e68e053eba01f4d3bf053f1f
Pull Request resolved: pytorch#86724
@facebook-github-bot facebook-github-bot deleted the gh/peterbell10/444/head branch June 8, 2023 18:21
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: bc-breaking Related to a BC-breaking change module: fft open source release notes: python_frontend release notes category topic: bc breaking topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants