Skip to content

Conversation

@mattip
Copy link
Contributor

@mattip mattip commented Aug 10, 2020

Fixes #42213

The original python code from torchaudio was converted to a native function, but used eye to allocate a Tensor and was much slower.
Using at::col2im (which is the equivalent of torch.nn.functional.fold) solved the slowdown.

@mthrok
Copy link
Contributor

mthrok commented Aug 10, 2020

@mattip Thanks for resolving this! Is it as fast as the original Python version?

@smessmer smessmer requested a review from mthrok August 10, 2020 21:30
@smessmer smessmer added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Aug 10, 2020
@mthrok mthrok self-assigned this Aug 10, 2020
@dr-ci
Copy link

dr-ci bot commented Aug 10, 2020

💊 CI failures summary and remediations

As of commit f38aa75 (more details on the Dr. CI page):


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)

ci.pytorch.org: 1 failed


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.

See how this bot performed.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@mthrok has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@mattip
Copy link
Contributor Author

mattip commented Aug 11, 2020

Now the script (from the same setup as in the issue) is at least as fast as the previous version. Here are the timings :

Before:

for torchaudio.istft 0.03506781195756048 0.003506781195756048
for torch.istft 13.575328684062697 1.3575328684062697

After:

for torchaudio.istft 0.03533014899585396 0.003533014899585396
for torch.istft 0.03239023999776691 0.0032390239997766913

@mthrok
Copy link
Contributor

mthrok commented Aug 11, 2020

Now the script (from the same setup as in the issue) is at least as fast as the previous version. Here are the timings :

Before:

for torchaudio.istft 0.03506781195756048 0.003506781195756048
for torch.istft 13.575328684062697 1.3575328684062697

After:

for torchaudio.istft 0.03533014899585396 0.003533014899585396
for torch.istft 0.03239023999776691 0.0032390239997766913

Thanks! This is great!

@facebook-github-bot
Copy link
Contributor

@mthrok merged this pull request in 77bd4d3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pytorch istft runs slower than torchaudio istft especially at higher n_fft

6 participants