tracel-ai/burn · error
Can't format yet
Error message
Can't format yet
What it means
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.
Source
Thrown at crates/burn-std/src/data/tensor/base.rs:551
value:
QuantValue::Q8F
| QuantValue::Q8S
// Display sub-byte values as i8
| QuantValue::Q4F
| QuantValue::Q4S
| QuantValue::Q2F
| QuantValue::Q2S,
..
} => {
format!("{:?} {scheme:?}", self.iter::<i8>().collect::<Vec<_>>())
},
QuantScheme {
mode: QuantMode::Symmetric,
value:
QuantValue::E4M3 | QuantValue::E5M2 | QuantValue::E2M1,
..
} => {
unimplemented!("Can't format yet");
}
QuantScheme {
mode: QuantMode::Lookup,
..
} => {
format!("<lookup-quantized> {scheme:?}")
}
},
};
f.write_str(fmt.as_str())
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::*;
use ::rand::{View on GitHub (pinned to d16f7ba2ed)
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.
Example fix
// before
println!("{}", quantized_tensor_data); // panics: Can't format yet
// after
println!("{:?}", quantized_tensor_data); // or dequantize first, then print floats Defensive patterns
Strategy: type-guard
Validate before calling
// before formatting a quantized tensor
fn is_displayable_quantized(dtype: &DType) -> bool {
match dtype {
DType::QFloat(s) => !matches!(
s,
QuantScheme { mode: QuantMode::Symmetric, value: QuantValue::E4M3 | QuantValue::E5M2 | QuantValue::E2M1, .. }
),
_ => true,
}
}
if !is_displayable_quantized(&data.dtype) { eprintln!("{:?}", data); } else { println!("{}", data); } Type guard
fn supports_q_display(scheme: &QuantScheme) -> bool {
!matches!(
scheme,
QuantScheme { mode: QuantMode::Symmetric, value: QuantValue::E4M3 | QuantValue::E5M2 | QuantValue::E2M1, .. }
)
} Try / catch
// Display panics rather than returning Result; guard before printing
if supports_q_display(&scheme) {
println!("{}", data);
} else {
println!("{:?}", data); // Debug fallback
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- todo!("Quantization not supported yet")
- unimplemented!()
- Not yet implemented for iteration
- lookup quantization is not supported for iteration
- Not yet supported
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/504c76769668b717.
Report an issue: GitHub.