Reputation: 303
I know that theano.tensor.fourier.fft
is essentially numpy.fft.fft
. However, I was wondering if the inverse FFT was implemented? Namely, is there something like a theano.tensor.fourier.ifft
, which is equivalent to numpy.fft.ifft
?
I noticed that this has it, but I'm not sure how complete or reliable it is for doing what I want. Perhaps someone with a better understanding of Theano can weigh in here.
Also, if I were to use this sandbox Fourier, how would I go about doing it? Simply calling theano.sandbox.fourier.fft(x)
, where x
is a 1D tensor, returns the error:
AttributeError: 'module' object has no attribute 'fourier'
Is there a way to fix this?
Upvotes: 3
Views: 680
Reputation: 34187
I can't comment on the robustness of the code but Theano as a whole is still in development (version 0.7) and this code is in the sandbox
which should, I believe, be considered even less robust than the rest of Theano.
It's clear that this FFT operation is incomplete because it is currently incapable of computing gradients (note the TODO comments). If you need gradients then sorry, this operation isn't going to help (maybe you could finish it off and submit the enhancement?)
This implementation is just a shim around numpy's implementation so if numpy's implementation is sufficiently complete and reliable for doing what you want then this Theano shim probably is as well.
Note that because this just wraps numpy, it won't run on the GPU and if you're mixing this operation with other GPU enabled operations and running on a GPU then you're going to have a slowdown due to data being copied backwards and forwards between main and GPU memories.
To use this operation you'd do this:
import theano
import theano.sandbox.fourier as tsf
tsf.ifft(frames=..., n=..., axis=...)
Upvotes: 3