- paddle.fft. ifftn ( x, s=None, axes=None, norm='backward', name=None )
Compute the N-D inverse discrete Fourier Transform.
This function computes the inverse of the N-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,
ifftn(fftn(x)) == xto within numerical accuracy.
The input, analogously to ifft, should be ordered in the same way as is returned by fftn, i.e., it should have the term for zero frequency in all axes in the low-order corner, the positive frequency terms in the first half of all axes, the term for the Nyquist frequency in the middle of all axes and the negative frequency terms in the second half of all axes, in order of decreasingly negative frequency.
x (Tensor) – The input data. It’s a Tensor type. It’s a complex.
s (sequence of ints, optional) – Shape (length of each transformed axis) of the output (
srefers to axis 0,
sto axis 1, etc.). This corresponds to
fft(x, n). Along any 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.
axes (sequence of ints, optional) – Axes used to calculate FFT. If not given, the last
len(s)axes are used, or all axes if s is also not specified.
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/non the ifft. “forward” instead applies the
1/nfactor on the forward tranform. For
norm="ortho", both directions are scaled by
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 by a combination of s and x, as explained in the parameters section above.
import numpy as np import paddle x = np.eye(3) xp = paddle.to_tensor(x) ifftn_xp = paddle.fft.ifftn(xp, axes=(1,)).numpy() print(ifftn_xp) # [[ 0.33333333+0.j 0.33333333+0.j 0.33333333-0.j ] # [ 0.33333333+0.j -0.16666667+0.28867513j -0.16666667-0.28867513j] # [ 0.33333333+0.j -0.16666667-0.28867513j -0.16666667+0.28867513j]]