Skip to content

Commit

Permalink
Update on "Use new FFT operators in stft"
Browse files Browse the repository at this point in the history
Fixes #42175 (comment)




[ghstack-poisoned]
  • Loading branch information
peterbell10 committed Dec 8, 2020
2 parents 39617bb + 855d198 commit b327d45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aten/src/ATen/native/SpectralOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,11 @@ Tensor istft(const Tensor& self, const int64_t n_fft, const optional<int64_t> ho
const auto hop_length = hop_lengthOpt.value_or(n_fft >> 2);
const auto win_length = win_lengthOpt.value_or(n_fft);

if (!self.is_complex()) {
TORCH_WARN_ONCE(
"istft will require a complex-valued input tensor in a future PyTorch release. "
"Matching the output from stft with return_complex=True. ");
}
Tensor input = self.is_complex() ? at::view_as_real(self) : self;
const auto input_dim = input.dim();
const auto n_frames = input.size(-2);
Expand Down
4 changes: 4 additions & 0 deletions torch/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,10 @@ def istft(input: Tensor, n_fft: int, hop_length: Optional[int] = None,
can either be complex (``channel``, ``fft_size``, ``n_frame``), or real
(``channel``, ``fft_size``, ``n_frame``, 2) where the ``channel``
dimension is optional.
.. deprecated:: 1.8.0
Real input is deprecated, use complex inputs as returned by
``stft(..., return_complex=True)`` instead.
n_fft (int): Size of Fourier transform
hop_length (Optional[int]): The distance between neighboring sliding window frames.
(Default: ``n_fft // 4``)
Expand Down

0 comments on commit b327d45

Please sign in to comment.