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

Compute the FFT of a signal that has Hermitian symmetry, a real spectrum.

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

  • n (int, optional) – The length of the output transform axis. For n output points, n//2 + 1 input points are necessary. If the length of the input tensor is greater than n, it will be cropped, if it is shorter than this, fill in zero. If n is not given, it is considered to be 2 * (k-1), where k is the length of the input axis specified along the ` axis’.

  • axis (int,optional) – Axis used to calculate FFT. If not specified, the last axis is used by default.

  • norm (str) – 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”.

  • 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. Truncated or zero fill input for the transformation along the axis indicated by axis, or the last input if axis is not specified. The length of the conversion axis is n, or 2 * k-2, if k is None, where k is the length of the input conversion axis. If the output is an odd number, you need to specify the value of ‘n’, such as 2 * k-1 in some cases.


import numpy as np
import paddle

x = np.array([1, -1j, -1])
xp = paddle.to_tensor(x)
hfft_xp = paddle.fft.hfft(xp).numpy()
#  [0. 0. 0. 4.]