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

Update calls to torch.stft to have return_complex=True #1096

Merged
merged 3 commits into from
Dec 17, 2020

Conversation

mthrok
Copy link
Collaborator

@mthrok mthrok commented Dec 17, 2020

Resolves #1095

Copy link
Contributor

@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.

Thank you, @mthrok!

@peterbell10
Copy link

Since the plan is to deprecate return_complex=False, you may want to go to torch.view_as_real(torch.stft(..., return_complex=True)).

@mruberry
Copy link
Contributor

That's a good future proofing idea, @peterbell10, but I suggest we just go with the simpler and smaller change for the moment and revisit how torchaudio wants to handle complex numbers for the 1.9 release. Maybe torchaudio will want to switch to using complex tensors.

@peterbell10
Copy link

Not sure I understand. view_as_real is the exact same data format as return_complex=False, so it doesn't require any further changes. It just avoids the warning.

@mruberry
Copy link
Contributor

mruberry commented Dec 17, 2020

Oh you're right, thank you. I forgot we're also putting a warning on this. It's been a long day...

Sorry @mthrok, I was mistaken. We should take @peterbell10's recommendation to use torch.view_as_real(torch.stft(..., return_complex=True)) because this will avoid a warning, since we're also deprecating return_complex=False for the 1.8 release.

@mthrok mthrok requested a review from mruberry December 17, 2020 01:54
@mthrok
Copy link
Collaborator Author

mthrok commented Dec 17, 2020

@peterbell10 @mruberry Update the PR to use return_complex=True + view_as_real. Review please.

@mthrok mthrok marked this pull request as ready for review December 17, 2020 01:55
Copy link
Contributor

@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 looks great. Thank you again @mthrok and @peterbell10!

@mthrok mthrok changed the title Update call to torch.stft to include return_complex=False Update call to torch.stft to include return_complex=True Dec 17, 2020
@mthrok mthrok changed the title Update call to torch.stft to include return_complex=True Update calls to torch.stft to have return_complex=True Dec 17, 2020
@mthrok mthrok merged commit 3ace593 into pytorch:master Dec 17, 2020
@mthrok mthrok deleted the update-stft branch December 17, 2020 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

torch.stft calls need to be updated to set the return_complex kwarg
4 participants