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
Migrate inverse short-time Fourier transform from torchaudio #34827
Conversation
💊 CircleCI build failures summary and remediationsAs of commit 45a146f (more details on the Dr. CI page): ✅ None of the build failures appear to be your fault 💚
🚧 1 upstream failure:These were probably caused by upstream breakages:
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. This comment has been revised 95 times. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vincentqb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add the documentation? Some documentation tests are failing.
50d40af
to
e9d8538
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vincentqb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
0d4e25d
to
678b2f7
Compare
I am confused about jit-ability of import torch
import torchaudio.functional
# Toggle this to change the behavior.
istft = torch.istft
# istft = torchaudio.functional.istft
stft_kwargs = {
'n_fft': 15,
'hop_length': 3,
'win_length': 11,
'window': torch.hamming_window(11),
'center': True,
'pad_mode': 'constant',
'normalized': True,
'onesided': False,
}
istft_kwargs = stft_kwargs.copy()
istft_kwargs['length'] = None
input = torch.stft(torch.randn(3, 15), **stft_kwargs)
def nested_istft(
stft_matrix, n_fft, hop_length, win_length, window, center, pad_mode, normalized, onesided, length):
# type: (Tensor, int, Optional[int], Optional[int], Optional[Tensor], bool, str, bool, bool, Optional[int]) -> Tensor
return istft(stft_matrix, n_fft, hop_length, win_length, window, center, pad_mode, normalized, onesided, length)
def test_func(istft_func):
jit_istft = torch.jit.script(istft_func)
py_result = istft_func(input, **istft_kwargs)
jit_result = jit_istft(input, **istft_kwargs)
assert torch.allclose(py_result, jit_result, atol=1e-6)
print('checking bare istft')
test_func(istft)
print('checking nested istft')
test_func(nested_istft)
print('ok') When
but when
|
@mthrok could you follow the example in #33737 ? Since the inputs all have one single type it shouldn't be very hard to make this torchscriptable. Just add basically we generally resolve |
Thanks @eellison for the suggestion. The trick did solve the issue above. I applied that to PR, but now some tests are failing due to something related to ATen, which were not happening earlier. |
2aae9df
to
1ba32bb
Compare
As suggested in #3775, this PR migrates Python code to perform ISTFT from torchaudio to PyTorch.
zeros
andones
)