irfft¶
- paddle.fft. irfft ( x, n=None, axis=- 1, norm='backward', name=None ) [source]
-
Computes the inverse of rfft.
This function calculates the inverse of the one-dimensional n point discrete Fourier transform of the actual input calculated by “rfft”. In other words,
irfft(rfft(a),len(a)) == a
is within the numerical accuracy range.The input shall be in the form of “rfft”, i.e. the actual zero frequency term, followed by the complex positive frequency term, in the order of increasing frequency. Because the discrete Fourier transform of the actual input is Hermite symmetric, the negative frequency term is regarded as the complex conjugate term of the corresponding positive frequency term.
- Parameters
-
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)
, wherek
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, optional) – 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 .
- Returns
-
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 as2 * k-1
in some cases.
Examples
>>> import paddle >>> x = paddle.to_tensor([1, -1j, -1]) >>> irfft_x = paddle.fft.irfft(x) >>> print(irfft_x) Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True, [0., 1., 0., 0.])