paddle.fft. ifft2 ( x, s=None, axes=(- 2, - 1), norm='backward', name=None ) [source]

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)) == x to 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 n for 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, optional) – 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.


>>> import paddle

>>> arr = paddle.arange(2, dtype="float64")
>>> x = paddle.meshgrid(arr, arr)[0]

>>> ifft2_xp = paddle.fft.ifft2(x)
>>> print(ifft2_xp)
Tensor(shape=[2, 2], dtype=complex128, place=Place(cpu), stop_gradient=True,
[[(0.5+0j), 0j],
 [(-0.5+0j), 0j]])