ifft(input, signal_ndim, normalized=False) → Tensor¶
Complex-to-complex Inverse Discrete Fourier Transform.
torch.ifft()is deprecated and will be removed in a future PyTorch release. Use the new torch.fft module functions, instead, by importing torch.fft and calling
This method computes the complex-to-complex inverse discrete Fourier transform. Ignoring the batch dimensions, it computes the following expression:
signal_ndimis number of dimensions for the signal, and is the size of signal dimension .
The argument specifications are almost identical with
fft(). However, if
normalizedis set to
True, this instead returns the results multiplied by , to become a unitary operator. Therefore, to invert a
normalizedargument should be set identically for
Returns the real and the imaginary parts together as one tensor of the same shape of
The inverse of this function is
For CUDA tensors, an LRU cache is used for cuFFT plans to speed up repeatedly running FFT methods on tensors of same geometry with same configuration. See cuFFT plan cache for more details on how to monitor and control the cache.
Due to limited dynamic range of half datatype, performing this operation in half precision may cause the first element of result to overflow for certain inputs.
For CPU tensors, this method is currently only available with MKL. Use
torch.backends.mkl.is_available()to check if MKL is installed.
A tensor containing the complex-to-complex inverse Fourier transform result
- Return type
>>> x = torch.randn(3, 3, 2) >>> x tensor([[[ 1.2766, 1.3680], [-0.8337, 2.0251], [ 0.9465, -1.4390]], [[-0.1890, 1.6010], [ 1.1034, -1.9230], [-0.9482, 1.0775]], [[-0.7708, -0.8176], [-0.1843, -0.2287], [-1.9034, -0.2196]]]) >>> y = torch.fft(x, 2) >>> torch.ifft(y, 2) # recover x tensor([[[ 1.2766, 1.3680], [-0.8337, 2.0251], [ 0.9465, -1.4390]], [[-0.1890, 1.6010], [ 1.1034, -1.9230], [-0.9482, 1.0775]], [[-0.7708, -0.8176], [-0.1843, -0.2287], [-1.9034, -0.2196]]])