- paddle.fft. ifft2 ( x, s=None, axes=(- 2, - 1), norm='backward', name=None )
Compute the 2-D inverse discrete Fourier Transform.
This function computes the inverse of the 2-D discrete Fourier Transform over any number of axes in an M-D array by means of the Fast Fourier Transform (FFT). In other words,
ifft2(fft2(x)) == xto within numerical accuracy. By default, the inverse transform is computed over the last two axes of the input array.
The input, analogously to ifft, should be ordered in the same way as is returned by fft2, i.e., it should have the term for zero frequency in the low-order corner of the two axes, the positive frequency terms in the first half of these axes, the term for the Nyquist frequency in the middle of the axes and the negative frequency terms in the second half of both axes, in order of decreasingly negative frequency.
x (Tensor) – The input data. It’s a Tensor type.
s (sequence of ints, optional) – Shape (length of each transformed axis) of the output. It should be a sequence of 2 integers. This corresponds to
fft(x, n). Along each axis, if the given shape is smaller than that of the input, the input is cropped. If it is larger, the input is padded with zeros. if s is not given, the shape of the input along the axes specified by axes is used. Default is None.
axes (sequence of ints, optional) – Axes over which to compute the FFT. It should be a sequence of 2 integers. If not specified, the last two axes are used by default.
norm (str) – Indicates which direction to scale the forward or backward transform pair and what normalization factor to use. The parameter value must be one of “forward” or “backward” or “ortho”. Default is “backward”.
name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.
Complex tensor. The truncated or zero-padded input, transformed along the axes indicated by axes, or the last two axes if axes is not given.
ValueError – if s not be a sequence of 2 integers or None.
ValueError – if axes not be a sequence of 2 integers or None.
ValueError – If the input dimension is smaller than 2.
import numpy as np import paddle x = np.mgrid[:2, :2] xp = paddle.to_tensor(x) ifft2_xp = paddle.fft.ifft2(xp).numpy() print(ifft2_xp) # [[ 0.5+0.j -0.5+0.j] # [ 0. +0.j 0. +0.j]]