torch.fft.fft
- torch.fft.fft(input, n=None, dim=-1, norm=None, *, out=None) →
Computes the one dimensional discrete Fourier transform of input.
input (Tensor) – the input tensor
n (int, optional) – Signal length. If given, the input will either be zero-padded or trimmed to this length before computing the FFT.
dim (int, optional) – The dimension along which to take the one dimensional FFT.
norm (str, optional) –
Normalization mode. For the forward transform
(fft()), these correspond to:
"forward" - normalize by 1/n
"backward" - no normalization
"ortho" - normalize by 1/sqrt(n) (making the FFT orthonormal)
Calling the backward transform () with the same
normalization mode will apply an overall normalization of between
the two transforms. This is required to make
the exact inverse.
out (Tensor, optional) – the output tensor.
>>> t = torch.arange(4)
>>> t
tensor([0, 1, 2, 3])
>>> torch.fft.fft(t)
tensor([ 6.+0.j, -2.+2.j, -2.+0.j, -2.-2.j])
>>> t = torch.tensor([0.+1.j, 2.+3.j, 4.+5.j, 6.+7.j])
>>> torch.fft.fft(t)
tensor([12.+16.j, -8.+0.j, -4.-4.j, 0.-8.j])
1/nDefault is "backward" (no normalization).