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
and1/n
respectively;”forward”: The factor of forward direction and backward direction are
1/n
and1
respectively;”ortho”: The factor of forward direction and backword direction are both
1/sqrt(n)
.
Where
n
is the multiplication of each element ins
.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 import numpy as np x = paddle.to_tensor(np.mgrid[:5, :5][0].astype(np.float32)) print(paddle.fft.rfft2(x)) # Tensor(shape=[5, 3], dtype=complex64, place=CUDAPlace(0), stop_gradient=True, # [[ (50+0j) , (1.1920928955078125e-07+0j) , 0j ], # [(-12.5+17.204774856567383j) , (-9.644234211236835e-08+7.006946134424652e-08j) , 0j ], # [(-12.500000953674316+4.061495304107666j) , (3.6837697336977726e-08-1.1337477445749755e-07j), 0j ], # [(-12.500000953674316-4.061495304107666j) , (3.6837697336977726e-08+1.1337477445749755e-07j), 0j ], # [(-12.5-17.204774856567383j) , (-9.644234211236835e-08-7.006946134424652e-08j) , 0j ]])