paddle.fft. ifft ( x, n=None, axis=- 1, norm='backward', name=None ) [source]

Compute the 1-D inverse discrete Fourier Transform.

This function computes the inverse of the 1-D n-point discrete Fourier transform computed by fft. In other words, ifft(fft(x)) == x to within numerical accuracy.

The input should be ordered in the same way as is returned by fft, i.e.,

  • x[0] should contain the zero frequency term,

  • x[1:n//2] should contain the positive-frequency terms,

  • x[n//2 + 1:] should contain the negative-frequency terms, in increasing order starting from the most negative frequency.

For an even number of input points, x[n//2] represents the sum of the values at the positive and negative Nyquist frequencies, as the two are aliased together.

  • x (Tensor) – The input data. It’s a Tensor type. It’s a complex.

  • n (int, optional) – The length of the output transform axis. If n is less than the length input, the input will be cropped. If larger, the input is filled with zeros. If n is not given, the input length along the axis specified by axis is used.

  • axis (int, optional) – Axis used to calculate FFT. If not specified, the last axis is 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”, meaning no normalization on the forward transforms and scaling by 1/n on the ifft. “forward” instead applies the 1/n factor on the forward tranform. For norm="ortho", both directions are scaled by 1/sqrt(n).

  • 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 axis indicated by axis, or the last one if axis is not specified.


import numpy as np
import paddle

x = np.exp(3j * np.pi * np.arange(7) / 7)
xp = paddle.to_tensor(x)
ifft_xp = paddle.fft.ifft(xp).numpy()
#  [0.14285714+1.79137191e-01j 0.14285714+6.87963741e-02j
#   0.14285714+1.26882631e-16j 0.14285714-6.87963741e-02j
#   0.14285714-1.79137191e-01j 0.14285714-6.25898038e-01j
#   0.14285714+6.25898038e-01j]