rfftn¶
- paddle.fft. rfftn ( x, s=None, axes=None, norm='backward', name=None ) [source]
-
The N dimensional FFT for real input.
This function computes the N-dimensional discrete Fourier Transform over any number of axes in an M-dimensional real array by means of the Fast Fourier Transform (FFT). By default, all axes are transformed, with the real transform performed over the last axis, while the remaining transforms are complex.
The transform for real input is performed over the last transformation axis, as by rfft, then the transform over the remaining axes is performed as by fftn. The order of the output is as for rfft for the final transformation axis, and as for fftn for the remaining transformation axes.
- Parameters
-
x (Tensor) – Input tensor, taken to be real.
s (Sequence[int], optional) – Shape to use from the exec fft. The final element of s corresponds to n for
rfft(x, n)
, while for the remaining axes, it corresponds to n forfft(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[int], optional) – Axes over which to compute the FFT. If not given, the last
len(s)
axes are used, or all axes if s is also not specified.norm (str, optional) –
Normalization mode, indicates which direction of the forward/backward pair of transforms is scaled and with what normalization factor. Include {“backward”, “ortho”, “forward”}, default value is “backward”. 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 backward 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
-
out(Tensor), complex tensor
Examples
>>> import paddle >>> # default, all axis will be used to exec fft >>> x = paddle.ones((2, 3, 4)) >>> print(paddle.fft.rfftn(x)) Tensor(shape=[2, 3, 3], dtype=complex64, place=Place(cpu), stop_gradient=True, [[[(24+0j), 0j, 0j], [0j, 0j, 0j], [0j, 0j, 0j]], [[0j, 0j, 0j], [0j, 0j, 0j], [0j, 0j, 0j]]]) >>> # use axes(2, 0) >>> print(paddle.fft.rfftn(x, axes=(2, 0))) Tensor(shape=[2, 3, 4], dtype=complex64, place=Place(cpu), stop_gradient=True, [[[(8+0j), 0j, 0j, 0j], [(8+0j), 0j, 0j, 0j], [(8+0j), 0j, 0j, 0j]], [[0j, 0j, 0j, 0j], [0j, 0j, 0j, 0j], [0j, 0j, 0j, 0j]]])