tracel-ai/burn · error

todo!("irfft is not supported for ndarray")

Error message

todo!("irfft is not supported for ndarray")

What it means

The ndarray backend's irfft (crates/burn-ndarray/src/ops/module.rs:415) is a stub that always panics with todo!("irfft is not supported for ndarray"). Inverse real FFT is not implemented for CPU ndarray.

Source

Thrown at crates/burn-ndarray/src/ops/module.rs:415

    ) -> FloatTensor<Self> {
        attention_fallback::<Self>(query, key, value, mask, attn_bias, options)
    }

    fn rfft(
        _signal: FloatTensor<Self>,
        _dim: usize,
        _n: Option<usize>,
    ) -> (FloatTensor<Self>, FloatTensor<Self>) {
        todo!("rfft is not supported for ndarray")
    }

    fn irfft(
        _spectrum_re: FloatTensor<Self>,
        _spectrum_im: FloatTensor<Self>,
        _dim: usize,
        _n: Option<usize>,
    ) -> FloatTensor<Self> {
        todo!("irfft is not supported for ndarray")
    }
}

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Use a backend that implements irfft (e.g. candle-based backend).
  2. Compute the inverse FFT externally (rustfft) and import the result as a tensor.
  3. Contribute an irfft implementation to burn-ndarray.
Defensive patterns

Strategy: validation

Validate before calling

// avoid irfft on ndarray backend; use a rustfft-based fallback instead
let spectrum = if backend_supports_irfft() { tensor.irfft(dim, n) } else { irfft_via_rustfft(&tensor) };

Prevention

When it happens

Trigger: Calling Tensor::irfft on a tensor whose backend is burn-ndarray, typically to reconstruct a time-domain signal from (re, im) spectra.

Common situations: Inverse STFT / waveform reconstruction in audio pipelines running on the CPU ndarray backend.

Related errors


AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05). Data as JSON: /api/errors/756e4a158b09b13b. Report an issue: GitHub.