fft2¶
- paddle.fft. fft2 ( x, s=None, axes=(- 2, - 1), norm='backward', name=None ) [source]
-
Compute the 2-D discrete Fourier Transform
This function computes the N-D discrete Fourier Transform over any axes in an M-D array by means of the Fast Fourier Transform (FFT). By default, the transform is computed over the last two axes of the input array, i.e., a 2-dimensional FFT.
- Parameters
-
x (Tensor) – The input data. It’s a Tensor type.
s (sequence of ints, optional) – Shape (length of each transformed axis) of the output. It should be a sequence of 2 integers. This corresponds to
n
forfft(x, n)
. Along each 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. Default is None.axes (sequence of ints, optional) – Axes over which to compute the FFT. It should be a sequence of 2 integers. If not specified, the last two axes are 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
-
Complex tensor. The truncated or zero-padded input, transformed along the axes indicated by axes, or the last two axes if axes is not given.
Examples
>>> import paddle >>> arr = paddle.arange(2, dtype="float64") >>> x = paddle.meshgrid(arr, arr)[0] >>> fft2_xp = paddle.fft.fft2(x) >>> print(fft2_xp) Tensor(shape=[2, 2], dtype=complex128, place=Place(cpu), stop_gradient=True, [[(2+0j), 0j], [(-2+0j), 0j]])