fn
ihfft2
→Tensorihfft2(input: Tensor, s: Sequence[int] | None = None, dim: Sequence[int] = (-2, -1), norm: str | None = None)2-D inverse FFT of a real signal, giving a Hermitian half-spectrum.
Computes the inverse of hfft2: given a real-valued 2-D input,
returns the conjugated one-sided 2-D spectrum (the Hermitian
half-spectrum). This is the 2-D specialisation of ihfftn.
For an input of shape , the output shape is — full along the first axis and compressed along the last.
Parameters
inputTensorReal-valued input tensor with at least 2 dimensions.
ssequence of int= NoneSignal sizes
(M_out, N_out) along the two transformed axes.
If None, current axis sizes are used.dimsequence of int= (-2, -1)The two axes over which to compute the 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 the last transformed axis has length
.
Notes
Round-trip with hfft2 — for a real tensor x of shape
:
Examples
Compute the Hermitian half-spectrum of a 2-D real image:
>>> x = lucid.randn(64, 64)
>>> H = lucid.fft.ihfft2(x)
>>> H.shape # last axis: 64 // 2 + 1 = 33
(64, 33)
Round-trip:
>>> x_rec = lucid.fft.hfft2(H, s=[64, 64])
>>> x_rec.shape
(64, 64)