rfft2

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

The two dimensional FFT with real tensor input.

This is really just rfftn with different default behavior. For more details see rfftn.

Parameters
  • x (Tensor) – Input tensor, taken to be real.

  • s (Sequence[int], optional) – Shape of the FFT.

  • axes (Sequence[int], optional) – Axes over which to compute the FFT.

  • norm (str, optional) –

    {“backward”, “ortho”, “forward”}, default is “backward”. Indicates which direction of the forward/backward pair of transforms is scaled and with what normalization factor. 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 backward 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 .

Returns

The result of the real 2-D FFT.

Return type

out(Tensor)

Examples:

>>> import paddle

>>> arr = paddle.arange(5, dtype="float64")
>>> x = paddle.meshgrid(arr, arr)[0]

>>> result = paddle.fft.rfft2(x)
>>> print(result.numpy())
[[50. +0.j 0. +0.j 0. +0.j]
 [-12.5+17.20477401j 0. +0.j 0. +0.j]
 [-12.5 +4.0614962j 0. +0.j 0. +0.j]
 [-12.5 -4.0614962j 0. +0.j 0. +0.j]
 [-12.5-17.20477401j 0. +0.j 0. +0.j]]