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

Computes the inverse of rfft2.

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

  • s (sequence of ints, optional) – Shape of the real output to the inverse FFT. Default is None.

  • axes (sequence of ints, optional) – The axes over which to compute the inverse FFT. Axes must be two-dimensional. 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”. The details of three operations are shown below:

    • ”backward”: The factor of forward direction and backward direction are 1 and 1/n respectively;

    • ”forward”: The factor of forward direction and backward direction are 1/n and 1 respectively;

    • ”ortho”: The factor of forward direction and backword direction are both 1/sqrt(n).

    Where n is the multiplication of each element in s .

  • 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 result of the inverse real 2-D FFT.


import paddle

x = paddle.to_tensor([[3.+3.j, 2.+2.j, 3.+3.j], [2.+2.j, 2.+2.j, 3.+3.j]])
irfft2_x = paddle.fft.irfft2(x)
# Tensor(shape=[2, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
#        [[ 2.37500000, -1.12500000,  0.37500000,  0.87500000],
#         [ 0.12500000,  0.12500000,  0.12500000,  0.12500000]])