I'm trying to implement this paper in tensorflow and keras. At the end of section 3 it says.

Note that although weighted SDR loss is a time-domain loss function,
it can be backpropagated through our framework.
Specifically, STFT and ISTFT operations are implemented as 1-D convolution
and deconvolution layers consisting of fixed filters initialized 
with the discrete Fourier transform matrix.

How would I go about implementing an STFT and an ISTFT as a 1-D convolution and 1-D deconvolution respectively? For example how would the window size and the hop length correspond to parameters of a convolution?

Conversely, could I just use tensorflow's built in STFT and inverse_STFT ops instead?

  • $\begingroup$ why we need to use conv1d instead of normal STFT, is it the same ? $\endgroup$
    – hieu
    Commented Dec 27, 2022 at 10:43

1 Answer 1


I found an implementation of STFT based on conv1d in pytorch here:


edit: Actually, the phasen repository took the STFT code from https://github.com/pseeth/torch-stft edit2: Asteroid has an alternative implementation of STFT and iSTFT: https://github.com/mpariente/asteroid/


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.