Skip to content

Commit 7bd7368

Browse files
committed
Fix type
1 parent 7bb3783 commit 7bd7368

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

torchaudio/functional.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def istft(
5050
win_length: Optional[int] = None,
5151
window: Optional[Tensor] = None,
5252
center: bool = True,
53-
pad_mode: str = None,
53+
pad_mode: Optional[str] = None,
5454
normalized: bool = False,
5555
onesided: bool = True,
5656
length: Optional[int] = None,
@@ -248,13 +248,12 @@ def griffinlim(
248248
tprev = rebuilt
249249

250250
# Invert with our current estimate of the phases
251-
inverse = torch.istft(
252-
specgram * angles,
253-
n_fft=n_fft,
254-
hop_length=hop_length,
255-
win_length=win_length,
256-
window=window,
257-
length=length).float()
251+
inverse = istft(specgram * angles,
252+
n_fft=n_fft,
253+
hop_length=hop_length,
254+
win_length=win_length,
255+
window=window,
256+
length=length).float()
258257

259258
# Rebuild the spectrogram
260259
rebuilt = torch.stft(inverse, n_fft, hop_length, win_length, window,
@@ -267,13 +266,12 @@ def griffinlim(
267266
angles = angles.div_(complex_norm(angles).add_(1e-16).unsqueeze(-1).expand_as(angles))
268267

269268
# Return the final phase estimates
270-
waveform = torch.istft(
271-
specgram * angles,
272-
n_fft=n_fft,
273-
hop_length=hop_length,
274-
win_length=win_length,
275-
window=window,
276-
length=length)
269+
waveform = istft(specgram * angles,
270+
n_fft=n_fft,
271+
hop_length=hop_length,
272+
win_length=win_length,
273+
window=window,
274+
length=length)
277275

278276
# unpack batch
279277
waveform = waveform.reshape(shape[:-2] + waveform.shape[-1:])

0 commit comments

Comments
 (0)