tracel-ai/burn · error
float_cummin: unsupported dtype {:?}
Error message
float_cummin: unsupported dtype {:?} What it means
float_cummin computes the running minimum; F32/F64 use dedicated f32 kernels and F16/BF16 route through cummin_half with f32 conversion. Other dtypes hit the panic arm. Only float tensors are accepted by this flex-backend op.
Source
Thrown at crates/burn-flex/src/ops/float.rs:800
}
DType::BF16 => {
crate::ops::cumulative::cumprod_half(tensor, dim, bf16::to_f32, bf16::from_f32)
}
_ => panic!("float_cumprod: unsupported dtype {:?}", tensor.dtype()),
}
}
fn float_cummin(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex> {
match tensor.dtype() {
DType::F32 => crate::ops::cumulative::cummin_f32(tensor, dim),
DType::F64 => crate::ops::cumulative::cummin_f64(tensor, dim),
DType::F16 => {
crate::ops::cumulative::cummin_half(tensor, dim, f16::to_f32, f16::from_f32)
}
DType::BF16 => {
crate::ops::cumulative::cummin_half(tensor, dim, bf16::to_f32, bf16::from_f32)
}
_ => panic!("float_cummin: unsupported dtype {:?}", tensor.dtype()),
}
}
fn float_cummax(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex> {
match tensor.dtype() {
DType::F32 => crate::ops::cumulative::cummax_f32(tensor, dim),
DType::F64 => crate::ops::cumulative::cummax_f64(tensor, dim),
DType::F16 => {
crate::ops::cumulative::cummax_half(tensor, dim, f16::to_f32, f16::from_f32)
}
DType::BF16 => {
crate::ops::cumulative::cummax_half(tensor, dim, bf16::to_f32, bf16::from_f32)
}
_ => panic!("float_cummax: unsupported dtype {:?}", tensor.dtype()),
}
}
fn float_cast(tensor: FloatTensor<Flex>, dtype: FloatDType) -> FloatTensor<Flex> {View on GitHub (pinned to d16f7ba2ed)
Solutions
- Cast to float before calling cummin: tensor.to_dtype(FloatDType::F32).cummin(dim).
- For integer data, consider sort/scan alternatives or implement an int cummin in the backend.
- Trace upstream ops to find where the tensor became Int and fix dtype there.
- Extend float_cummin with the missing dtype arm if you control the backend.
Example fix
// before
let m = idx.cummin(1); // idx: Int -> panic
// after
let m = idx
.to_dtype(burn::tensor::FloatDType::F32)
.cummin(1); Defensive patterns
Strategy: validation
Validate before calling
assert!(matches!(tensor.dtype(), DType::F32 | DType::F64 | DType::F16 | DType::BF16), "cummin needs a float tensor, got {:?}", tensor.dtype()); Type guard
fn is_float_dtype(dtype: &DType) -> bool { matches!(dtype, DType::F32 | DType::F64 | DType::F16 | DType::BF16) } Try / catch
// Guard the call site; panics are not recoverable:
if is_float_dtype(&tensor.dtype()) { let m = tensor.cummin(dim); } Prevention
- Cast integer sequences to float before running min/max scans.
- Keep scan helpers generic over Float only, so misuse surfaces at compile time.
- Trace dtype provenance when refactoring tensor pipelines.
- Verify backend op support before porting dtype-flexible torch code.
When it happens
Trigger: Calling Tensor::cummin (running min along a dim) on burn-flex with a tensor whose dtype is not one of the four float dtypes.
Common situations: Running-min over integer sequences (e.g. index arrays); generic helpers shared across dtypes where an Int tensor reached the float path; porting torch cummin code that accepted ints.
Related errors
- burn-flex does not support Bool(U32) storage (only Native an
- compare_int: unsupported dtype {:?}
- compare_int_elem: unsupported dtype {:?}
- any_float: unsupported dtype {:?}
- all_float: unsupported dtype {:?}
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/1b88720dac646e1b.
Report an issue: GitHub.