The torch.fft function requires a complex input and produces complex output, so we cannot take fft of a real signal. And we can also not cast the real input to complex for the lack of complex data type. So how do we use the torch.fft function?
I believe there’s an rfft function as well: https://pytorch.org/docs/stable/torch.html?highlight=rfft#torch.rfft
Ok, thanks a lot.
Also, I am working on training a convolutional neural network in the fourier domain. So after taking the rfft of the images and padded weights, I need to take their dot product which is the fourier domain equivalent of spatial domain convolution.
So just like the dot product operator on complex input here, I might need to use many other operators on complex inputs in my cnn.
Given that PyTorch doesn’t support a complex data type yet, is it advisable to continue in PyTorch or is it better to shift to another platform like TensorFlow etc. which supports complex data type?
I honestly have no idea what tensorflow does. If they store a complex tensor as two real tensors I doubt the speed would be much different than if you implement complex operations yourself with the two real tensors returned from pytorch something along the lines of: http://mathworld.wolfram.com/ComplexMultiplication.html