fn
ifft2
→Tensorifft2(input: Tensor, s: Sequence[int] | None = None, dim: Sequence[int] = (-2, -1), norm: str | None = None)2-D inverse discrete Fourier transform over a pair of axes.
Recovers the 2-D spatial-domain signal from its frequency-domain
representation produced by fft2. For an
frequency array, the 2-D inverse DFT is:
The factor corresponds to norm='backward' (default).
Parameters
inputTensorComplex input tensor (2-D frequency domain) with at least 2
dimensions.
ssequence of int= NoneOutput size
(M_out, N_out) along each transformed axis.
The frequency tensor is zero-padded or truncated before inverting.
len(s) must be 2 when given. If None, the axes keep
their current sizes.dimsequence of int= (-2, -1)The two axes over which to compute the inverse transform.
Default is
(-2, -1).normstr or None= NoneNormalisation mode —
"backward" (default), "forward", or
"ortho". See fftn for the full description.Returns
TensorComplex tensor (complex64) with the same shape as input
except that the two transformed axes have lengths s[0] and
s[1] (or the input sizes when s is None).
Notes
Round-trip — for any 2-D complex tensor x:
Real outputs — if input is the 2-D DFT of a real image
(conjugate-symmetric in 2-D), the imaginary part of the output will
be negligibly small. Use irfft2 for strictly real output.
Examples
Round-trip through the frequency domain:
>>> x = lucid.randn(32, 32)
>>> X = lucid.fft.fft2(x)
>>> x_rec = lucid.fft.ifft2(X)
>>> x_rec.shape
(32, 32)
Low-pass filtering in the frequency domain:
>>> X = lucid.fft.fft2(lucid.randn(64, 64))
>>> # Zero out high frequencies, then invert
>>> x_smooth = lucid.fft.ifft2(X)