Skip to content

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

Merged
mthrok merged 3 commits intopytorch:masterfrom
mthrok:update-stft
Dec 17, 2020
Merged

Update calls to torch.stft to have return_complex=True#1096
mthrok merged 3 commits intopytorch:masterfrom
mthrok:update-stft

Conversation

@mthrok
Copy link
Copy Markdown
Contributor

@mthrok mthrok commented Dec 17, 2020

Resolves #1095

Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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