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 along the last axis, preserving all leading batch dimensions.
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. In exact real arithmetic, imaginary DC and
even-length Nyquist coordinates contribute zero and have zero derivatives. The dense path still
multiplies these coordinates by zero, so it does not suppress NaN or infinity. Passing n
explicitly distinguishes lengths such as four and five, which store the same number of bins.