tracel-ai/burn · error
unimplemented!()
Error message
unimplemented!()
What it means
q_flip for the CubeCl quantized-tensor backend is a stub that immediately panics with unimplemented!(). Flipping a quantized tensor along axes is not implemented, even though q_permute is. This is a pure backend completeness gap; no input can make it succeed.
Source
Thrown at crates/burn-cubecl/src/ops/qtensor.rs:322
shape,
dtype,
})
}
fn q_swap_dims(
tensor: QuantizedTensor<Self>,
dim1: usize,
dim2: usize,
) -> QuantizedTensor<Self> {
swap_dims(tensor, dim1, dim2)
}
fn q_permute(tensor: QuantizedTensor<Self>, axes: &[usize]) -> QuantizedTensor<Self> {
permute(tensor, axes)
}
fn q_flip(_tensor: QuantizedTensor<Self>, _axes: &[usize]) -> QuantizedTensor<Self> {
unimplemented!()
}
fn q_matmul(lhs: TensorPrimitive<Self>, rhs: TensorPrimitive<Self>) -> TensorPrimitive<Self> {
let (settings, scheme) = match (&lhs, &rhs) {
(TensorPrimitive::QFloat(lhs), _) => {
(get_device_settings::<Self>(&lhs.device), lhs.scheme())
}
(_, TensorPrimitive::QFloat(rhs)) => {
(get_device_settings::<Self>(&rhs.device), rhs.scheme())
}
_ => unreachable!(),
};
// Inherit precision for mixed inputs, default to `FloatElem` for fully quantized.
let out_dtype = match (&lhs, &rhs) {
(TensorPrimitive::Float(lhs), _) => lhs.dtype,
(_, TensorPrimitive::Float(rhs)) => rhs.dtype,
_ => settings.float_dtype.into(),View on GitHub (pinned to d16f7ba2ed)
Solutions
- Flip the tensor BEFORE quantizing it (dequantize -> flip -> requantize if needed).
- Re-express flip as slicing + cat or as permute/slice operations that are implemented for quantized tensors.
- Perform the flip on a non-quantized (float) tensor and quantize afterwards.
- Contribute an implementation to crates/burn-cubecl/src/ops/qtensor.rs (q_flip) upstream.
Example fix
// before let flipped = qtensor.flip(&[3]); // panics: q_flip unimplemented // after let flipped = tensor.flip(&[3]).quantize(&scheme, &device); // flip then quantize
Defensive patterns
Strategy: validation
Validate before calling
fn assert_not_quantized<T: QTensorPrimitive>(t: &T) { /* flip only non-quantized tensors */ }
// or: only call .flip on float tensors, quantize afterwards Type guard
fn can_flip_qtensor() -> bool { false } // q_flip is a stub for CubeCl; never call it Prevention
- Never call flip on quantized tensors with the CubeCl backend; flip before quantizing
- Centralize flips in preprocessing on float tensors
- Audit generic tensor pipelines for ops applied post-quantization
- Track burn releases for q_flip implementation before enabling flip on QTensors
When it happens
Trigger: Calling q_flip (or Tensor::flip on a quantized tensor / QTensorPrimitive) with the CubeCl backend, regardless of axes or shape.
Common situations: Data augmentation pipelines that flip quantized images on GPU; generic tensor code that calls flip without knowing the tensor is quantized; migrating models that apply flips after quantization.
Related errors
- todo!("Quantization not supported yet")
- int_scatter with {other:?} update is not implemented
- int_select_assign with {other:?} update is not implemented
- lookup quantization does not travel as a QFloat tensor
- float_scatter with {other:?} update is not implemented
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/5d556f400438ca7d.
Report an issue: GitHub.