paddle.fft. ifftshift ( x, axes=None, name=None ) [source]

The inverse of fftshift. Although the even length ‘x’ is the same, the function of the odd length ‘x’ is different. An example.

  • n (int) – Dimension inputed.

  • axes (int|tuple, optional) – The axis on which to move. The default is none, which moves all axes. Default is None.

  • 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.


Tensor. The shifted tensor.


import numpy as np
import paddle

x = np.array([3, 1, 2, 2, 3], dtype=float)
n = x.size
fftfreq_xp = paddle.fft.fftfreq(n, d=0.3)
res = paddle.fft.ifftshift(fftfreq_xp).numpy()
#  [ 1.3333334 -1.3333334 -0.6666667  0.         0.6666667]