- paddle.fft. irfftn ( x, s=None, axes=None, norm='backward', name=None ) [source]
Computes the inverse of rfftn.
This function computes the inverse of the N-D discrete Fourier Transform for real input over any number of axes in an M-D array by means of the Fast Fourier Transform (FFT). In other words,
irfftn(rfftn(x), x.shape) == xto within numerical accuracy. (The
x.shapeis necessary like
len(x)is for irfft, and for the same reason.)
The input should be ordered in the same way as is returned by rfftn, i.e., as for irfft for the final transformation axis, and as for ifftn along all the other axes.
x (Tensor) – The input data. It’s a Tensor type.
s (sequence of ints, optional) –
The length of the output transform axis. (
srefers to axis 0,
sto axis 1, etc.).
s is also the number of input points used along this axis, except for the last axis, where
s[-1]//2+1points of the input are used.
Along any axis, if the shape indicated by s 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. Except for the last axis which is taken to be
kis the length of the input along that axis.
axes (sequence of ints, optional) – Axes over which to compute the inverse 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”. The details of three operations are shown below:
”backward”: The factor of forward direction and backward direction are
”forward”: The factor of forward direction and backward direction are
”ortho”: The factor of forward direction and backword direction are both
nis the multiplication of each element in
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.
Real tensor. The truncated or zero-padded input, transformed along the axes indicated by axes, or by a combination of s or x, as explained in the parameters section above. The length of each transformed axis is as given by the corresponding element of s, or the length of the input in every axis except for the last one if s is not given. In the final transformed axis the length of the output when s is not given is
mis the length of the final transformed axis of the input. To get an odd number of output points in the final axis, s must be specified.
import paddle x = paddle.to_tensor([2.+2.j, 2.+2.j, 3.+3.j]).astype(paddle.complex128) print(x) irfftn_x = paddle.fft.irfftn(x) print(irfftn_x) # Tensor(shape=, dtype=complex128, place=Place(cpu), stop_gradient=True, # [(2+2j), (2+2j), (3+3j)]) # Tensor(shape=, dtype=float64, place=Place(cpu), stop_gradient=True, # [ 2.25000000, -1.25000000, 0.25000000, 0.75000000])