STFT and Inverste STFT (FFT)

Is there an implementation of the short time fourier transform (STFT )in Pytorch?
The purpose is to use it as a loss function, thus requiring forward and backward passes!

There is a repo but it does not support autograd.

1 Like

a differentiable FFT layer doesnt exist yet looks like it.

Looks like a good friend of mine, Prem Seetharaman, has written a pytorch implementation.
@smto What do you think about adding this to Pytorch?

1 Like

this looks super useful and worth including in the core. i’ll open an issue and we’ll pull this in.


torch.stft() calculates STFT.
I can not find device parameter in there. How can I compute it on CUDA.

it will be useful if it can also be developed for 2d…

I notice that the torch.stft() function doesn’t seem to have come with an ISTFT method. The linked library included one. Seems like it should be pretty easy to include this as an inverse convolution. Should I make a pull request to include the inverse?

Hi, do you have a functional implementation? (which works with several windows and so on) I coded one which has some problems depending on the recovered size.