rfft

paddle.fft. rfft ( x, n=None, axis=- 1, norm='backward', name=None ) [source]

The one dimensional FFT for real input.

This function computes the one dimensional n-point discrete Fourier Transform (DFT) of a real-valued tensor by means of an efficient algorithm called the Fast Fourier Transform (FFT).

When the DFT is computed for purely real input, the output is Hermitian-symmetric. This function does not compute the negative frequency terms, and the length of the transformed axis of the output is therefore n//2 + 1.

Parameters
  • x (Tensor) – Real-valued input tensor

  • n (int, optional) – Number of points along transformation axis in the input to use. If n is smaller than the length of the input, the input is cropped. If it is larger, the input is padded with zeros. If n is not given, the length of the input along the axis specified by axis is used.

  • axis (int, optional) – Axis over which to compute the FFT. Default value is last axis.

  • 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”.

  • 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

complex tensor

Return type

out(Tensor)

Raises:

Examples: .. code-block:: python

System Message: ERROR/3 (/usr/local/lib/python3.8/site-packages/paddle/fft.py:docstring of paddle.fft.rfft, line 41)

Unexpected indentation.

import paddle

x = paddle.to_tensor([0.0, 1.0, 0.0, 0.0]) print(paddle.fft.rfft(x)) # Tensor(shape=[3], dtype=complex64, place=CUDAPlace(0), stop_gradient=True, # [ (1+0j), -1j , (-1+0j)])