Differentiable real Fourier transforms #
These operations keep real and imaginary coordinates in a final axis of length two. Models can therefore use real FFTs without changing scalar type. Eager CUDA execution uses the native transform and its packed-real adjoint. Other interpreters multiply by the specification matrices, so their existing matrix JVP and VJP rules also cover these transforms and higher derivatives.
The portable implementation is a dense reference transform. The native implementation uses cuFFT; selecting the same mathematical operation does not imply the same floating-point order.
Choose Fourier execution without changing normalization or spectral parameters.
- automatic : SpectralPath
Use native FFT hooks when supported, otherwise differentiable reference operations.
- denseReference : SpectralPath
Always use dense reference transforms.
Instances For
Instances For
Instances For
Unnormalized real Fourier transform of each row, returned as [batch, n / 2 + 1, 2].
The last coordinate is (real, imaginary) and the phase convention is exp(-2*pi*i*k*t/n).
The positive-length witness rules out an undefined transform; an empty batch is allowed. This
operation records differentiable references, including on interpreters that use the dense fallback.
Instances For
Normalized inverse real transform with output length n.
Interior bins are completed by conjugate symmetry. Imaginary DC and even-length Nyquist inputs
are ignored, and their derivatives are zero. Passing n explicitly distinguishes lengths such
as four and five, which have the same number of stored bins.