{"record":{"id":"504c76769668b717","repo":"tracel-ai/burn","slug":"can-t-format-yet","errorCode":null,"errorMessage":"Can't format yet","messagePattern":"Can't format yet","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-std/src/data/tensor/base.rs","lineNumber":551,"sourceCode":"                    value:\n                        QuantValue::Q8F\n                        | QuantValue::Q8S\n                        // Display sub-byte values as i8\n                        | QuantValue::Q4F\n                        | QuantValue::Q4S\n                        | QuantValue::Q2F\n                        | QuantValue::Q2S,\n                    ..\n                } => {\n                    format!(\"{:?} {scheme:?}\", self.iter::<i8>().collect::<Vec<_>>())\n                },\n                QuantScheme {\n                        mode: QuantMode::Symmetric,\n                        value:\n                            QuantValue::E4M3 | QuantValue::E5M2 | QuantValue::E2M1,\n                        ..\n                    } => {\n                        unimplemented!(\"Can't format yet\");\n                    }\n                QuantScheme {\n                    mode: QuantMode::Lookup,\n                    ..\n                } => {\n                    format!(\"<lookup-quantized> {scheme:?}\")\n                }\n            },\n        };\n        f.write_str(fmt.as_str())\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use crate::*;\n    use ::rand::{","sourceCodeStart":533,"sourceCodeEnd":569,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-std/src/data/tensor/base.rs#L533-L569","documentation":"TensorData's Display implementation (crates/burn-std/src/data/tensor/base.rs:512-563) formats quantized tensors by casting values to i8 and printing them. Only symmetric quantization with Q8/Q4/Q2 QuantValues is handled; E4M3, E5M2, and E2M1 float-point quantized data hits an explicit `unimplemented!` because formatting for float-point quantized element types has not been written. This is a deliberate placeholder panic, not a data corruption or logic bug.","triggerScenarios":"Calling `format!(\"{}\", tensor_data)`, `println!(\"{}\", ...)` or any Display usage (e.g. `to_string()`) on a TensorData whose dtype is DType::QFloat(scheme) where scheme.mode is Symmetric and scheme.value is QuantValue::E4M3, E5M2, or E2M1.","commonSituations":"Debug-logging a float8/float4-quantized tensor (e.g. after quantize() with q_float E4M3 scheme) or printing tensor contents in a REPL/test while working with FP8 quantization in burn.","solutions":["Do not rely on Display for E4M3/E5M2/E2M1 quantized tensors; use the Debug impl (`{:?}` on TensorData) which prints raw bytes and dtype without this match arm.","Inspect values via dequantization APIs instead of Display (convert to float then print).","Track/upgrade burn to a version where E4M3/E5M2/E2M1 Display formatting is implemented.","If printing is essential, manually unpack bytes and format them yourself."],"exampleFix":"// before\nprintln!(\"{}\", quantized_tensor_data); // panics: Can't format yet\n// after\nprintln!(\"{:?}\", quantized_tensor_data); // or dequantize first, then print floats","handlingStrategy":"type-guard","validationCode":"// before formatting a quantized tensor\nfn is_displayable_quantized(dtype: &DType) -> bool {\n    match dtype {\n        DType::QFloat(s) => !matches!(\n            s,\n            QuantScheme { mode: QuantMode::Symmetric, value: QuantValue::E4M3 | QuantValue::E5M2 | QuantValue::E2M1, .. }\n        ),\n        _ => true,\n    }\n}\nif !is_displayable_quantized(&data.dtype) { eprintln!(\"{:?}\", data); } else { println!(\"{}\", data); }","typeGuard":"fn supports_q_display(scheme: &QuantScheme) -> bool {\n    !matches!(\n        scheme,\n        QuantScheme { mode: QuantMode::Symmetric, value: QuantValue::E4M3 | QuantValue::E5M2 | QuantValue::E2M1, .. }\n    )\n}","tryCatchPattern":"// Display panics rather than returning Result; guard before printing\nif supports_q_display(&scheme) {\n    println!(\"{}\", data);\n} else {\n    println!(\"{:?}\", data); // Debug fallback\n}","preventionTips":["Never use Display on QFloat tensors with E4M3/E5M2/E2M1 values; prefer Debug output.","Wrap printing of unknown-typed tensor data behind a dtype check helper.","Pin/track burn versions for float-point quantization Display support."],"tags":["rust","burn","quantization","unimplemented","display"],"backgroundTag":"unimplemented-feature-panic","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"}