{"record":{"id":"a181c465d54c1259","repo":"tracel-ai/burn","slug":"todo-rfft-is-not-supported-for-ndarray","errorCode":null,"errorMessage":"todo!(\"rfft is not supported for ndarray\")","messagePattern":"todo!\\(\"rfft is not supported for ndarray\"\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-ndarray/src/ops/module.rs","lineNumber":406,"sourceCode":"    }\n\n    fn attention(\n        query: FloatTensor<Self>,\n        key: FloatTensor<Self>,\n        value: FloatTensor<Self>,\n        mask: Option<burn_backend::tensor::BoolTensor<Self>>,\n        attn_bias: Option<FloatTensor<Self>>,\n        options: AttentionModuleOptions,\n    ) -> FloatTensor<Self> {\n        attention_fallback::<Self>(query, key, value, mask, attn_bias, options)\n    }\n\n    fn rfft(\n        _signal: FloatTensor<Self>,\n        _dim: usize,\n        _n: Option<usize>,\n    ) -> (FloatTensor<Self>, FloatTensor<Self>) {\n        todo!(\"rfft is not supported for ndarray\")\n    }\n\n    fn irfft(\n        _spectrum_re: FloatTensor<Self>,\n        _spectrum_im: FloatTensor<Self>,\n        _dim: usize,\n        _n: Option<usize>,\n    ) -> FloatTensor<Self> {\n        todo!(\"irfft is not supported for ndarray\")\n    }\n}\n","sourceCodeStart":388,"sourceCodeEnd":418,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-ndarray/src/ops/module.rs#L388-L418","documentation":"The ndarray backend's rfft (crates/burn-ndarray/src/ops/module.rs:406) is a stub that always panics with todo!(\"rfft is not supported for ndarray\"). Real-valued FFT is simply not implemented for the CPU ndarray backend.","triggerScenarios":"Calling Tensor::rfft (any dim/n) on a tensor whose backend is burn-ndarray.","commonSituations":"Running audio/signal-processing models (spectrogram, STFT) on CPU via ndarray; the same code works on a GPU backend that implements FFT.","solutions":["Switch to a backend that implements rfft (e.g. the candle or cubecl-backed backends).","Compute the FFT outside burn (e.g. via the rustfft crate) and load the result back as a tensor.","Implement rfft for burn-ndarray using rustfft and contribute it upstream."],"exampleFix":"// before\nlet (re, im) = signal.rfft(1, None); // panics on ndarray backend\n// after: use a supported backend\n#[cfg(feature = \"candle\")]\nlet (re, im) = signal_candle.rfft(1, None);","handlingStrategy":"validation","validationCode":"// guard before calling rfft on ndarray backend\nif std::any::TypeId::of::<B>() != supported_fft_backend() { /* route to rustfft fallback */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid Tensor::rfft on the ndarray backend; use a backend with FFT support.","Isolate FFT code behind a trait/backend feature gate.","Check burn's op support table per backend before using spectral ops."],"tags":["rust","burn","ndarray","fft","unimplemented"],"backgroundTag":"op-not-implemented-for-backend","analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}