{"record":{"id":"d087bae76b9fc8fd","repo":"tracel-ai/burn","slug":"todo-quantization-not-supported-yet","errorCode":null,"errorMessage":"todo!(\"Quantization not supported yet\")","messagePattern":"todo!\\(\"Quantization not supported yet\"\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-dispatch/src/macros.rs","lineNumber":443,"sourceCode":"macro_rules! transaction_op_arms {\n    ($tx:ident, $first:expr; $([$Backend:ident, $cfg:meta]),*) => {{\n        match &$first.kind {\n            // Autodiff arm first\n            #[cfg(feature = \"autodiff\")]\n            $crate::DispatchTensorKind::Autodiff(inner) => {\n                // Recursively dispatch on inner\n                match **inner {\n                    $(\n                    #[cfg($cfg)]\n                    $crate::DispatchTensorKind::$Backend(_) => {\n                        type B = $crate::backends::$Backend;\n\n                        // Unwrap vec\n                        let floats = unwrap_vec!(@autodiff $Backend, $tx.read_floats, autodiff_inner);\n                        let ints = unwrap_vec!($Backend, $tx.read_ints, int);\n                        let bools = unwrap_vec!($Backend, $tx.read_bools, bool);\n                        // Not supported\n                        let qfloats = $tx.read_qfloats.into_iter().map(|_t| todo!(\"Quantization not supported yet\")).collect();\n\n                        B::tr_execute(TransactionPrimitive::new(floats, qfloats, ints, bools)).await\n                    }\n                )*\n                    $crate::DispatchTensorKind::Autodiff(..) => unreachable!(\"Autodiff should not wrap an autodiff tensor.\")\n                }\n            },\n\n            $(\n                #[cfg($cfg)]\n                $crate::DispatchTensorKind::$Backend(_) => {\n                    type B = $crate::backends::$Backend;\n\n                    // Unwrap vec\n                    let floats = unwrap_vec!($Backend, $tx.read_floats, float);\n                    let ints = unwrap_vec!($Backend, $tx.read_ints, int);\n                    let bools = unwrap_vec!($Backend, $tx.read_bools, bool);\n                    // Not supported","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-dispatch/src/macros.rs#L425-L461","documentation":"In burn-dispatch's transaction unwrapping macro, when a transaction containing quantized tensors (`read_qfloats`) is dispatched to a backend, the quantized tensors are not converted — each element is mapped to `todo!(\"Quantization not supported yet\")`, panicking. Transactions (batched read/write ops) currently support floats, ints, and bools only.","triggerScenarios":"Executing a transaction (e.g. `tr_execute` / `execute_async` through the dispatch layer, as in the autodiff transaction op at crates/burn-autodiff/src/ops/transaction.rs:18) where the transaction's `read_qfloats` vec contains at least one quantized tensor.","commonSituations":"Running quantized inference through the autodiff/dispatch stack where ops get batched into a transaction; mixing quantized and float ops so the quantized tensor ends up in a multi-op transaction; calling backends that route through dispatch macros without quantization support.","solutions":["Avoid transactions for quantized tensors: execute the quantized op standalone instead of within a batched transaction.","Dequantize to float before the ops that get transactionalized, and quantize afterwards.","Use a backend/feature path with quantization support so quantized primitives are unwrapped correctly.","Upgrade burn — this is a known gap that may be implemented in newer versions."],"exampleFix":"// before\nlet out = TransactionPrimitive::new(floats, vec![q_tensor], ints, bools); // panics in dispatch\n// after\nlet f = q_tensor.dequantize();\nlet out = TransactionPrimitive::new(floats_with_f, vec![], ints, bools); // floats only","handlingStrategy":"validation","validationCode":"fn transaction_supported(tx: &Transaction) -> bool {\n    tx.read_qfloats.is_empty() && tx.write_qfloats.is_empty()\n}","typeGuard":"fn has_qfloats(tx: &Transaction) -> bool { !tx.read_qfloats.is_empty() || !tx.write_qfloats.is_empty() }","tryCatchPattern":null,"preventionTips":["Exclude quantized tensors from batched transactions; run them as standalone ops.","Dequantize before ops that may be fused into transactions.","Confirm backend quantization support before enabling quantized inference.","Pin to burn versions where transaction quantization is implemented if you need it."],"tags":["burn","quantization","transaction","dispatch","todo"],"backgroundTag":"unsupported-dtype","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"}