Unverified Commit 6304db75 authored by moto's avatar moto Committed by GitHub
Browse files

Call torch.stft directly (#531)

* Update requirements and travis installation

* Drop support for 3.5 and add test for 3.8

* Call torch.stft directly
parent f3217257
...@@ -36,32 +36,6 @@ __all__ = [ ...@@ -36,32 +36,6 @@ __all__ = [
] ]
# TODO: remove this once https://github.com/pytorch/pytorch/issues/21478 gets solved
@torch.jit.ignore
def _stft(
waveform: Tensor,
n_fft: int,
hop_length: Optional[int],
win_length: Optional[int],
window: Optional[Tensor],
center: bool,
pad_mode: str,
normalized: bool,
onesided: bool
) -> Tensor:
return torch.stft(
waveform,
n_fft,
hop_length,
win_length,
window,
center,
pad_mode,
normalized,
onesided,
)
def istft( def istft(
stft_matrix: Tensor, stft_matrix: Tensor,
n_fft: int, n_fft: int,
...@@ -265,7 +239,7 @@ def spectrogram( ...@@ -265,7 +239,7 @@ def spectrogram(
waveform = waveform.view(-1, shape[-1]) waveform = waveform.view(-1, shape[-1])
# default values are consistent with librosa.core.spectrum._spectrogram # default values are consistent with librosa.core.spectrum._spectrogram
spec_f = _stft( spec_f = torch.stft(
waveform, n_fft, hop_length, win_length, window, True, "reflect", False, True waveform, n_fft, hop_length, win_length, window, True, "reflect", False, True
) )
...@@ -365,7 +339,7 @@ def griffinlim( ...@@ -365,7 +339,7 @@ def griffinlim(
length=length).float() length=length).float()
# Rebuild the spectrogram # Rebuild the spectrogram
rebuilt = _stft(inverse, n_fft, hop_length, win_length, window, rebuilt = torch.stft(inverse, n_fft, hop_length, win_length, window,
True, 'reflect', False, True) True, 'reflect', False, True)
# Update our phase estimates # Update our phase estimates
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment