tracel-ai/burn · error
int_cummax: unsupported dtype {:?}
Error message
int_cummax: unsupported dtype {:?} What it means
int_cummax computes the running maximum along a dimension for each supported integer dtype (I64..U8). The panic fires when the tensor dtype is not an integer type (float/bool), indicating a non-integer tensor reached the integer cumulative-max path. It is the same dtype-dispatch guard pattern used by the other cumulative ops.
Source
Thrown at crates/burn-flex/src/ops/int.rs:738
DType::U64 => crate::ops::cumulative::cummin::<u64>(tensor, dim),
DType::U32 => crate::ops::cumulative::cummin::<u32>(tensor, dim),
DType::U16 => crate::ops::cumulative::cummin::<u16>(tensor, dim),
DType::U8 => crate::ops::cumulative::cummin::<u8>(tensor, dim),
dt => panic!("int_cummin: unsupported dtype {:?}", dt),
}
}
fn int_cummax(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex> {
match tensor.dtype() {
DType::I64 => crate::ops::cumulative::cummax::<i64>(tensor, dim),
DType::I32 => crate::ops::cumulative::cummax::<i32>(tensor, dim),
DType::I16 => crate::ops::cumulative::cummax::<i16>(tensor, dim),
DType::I8 => crate::ops::cumulative::cummax::<i8>(tensor, dim),
DType::U64 => crate::ops::cumulative::cummax::<u64>(tensor, dim),
DType::U32 => crate::ops::cumulative::cummax::<u32>(tensor, dim),
DType::U16 => crate::ops::cumulative::cummax::<u16>(tensor, dim),
DType::U8 => crate::ops::cumulative::cummax::<u8>(tensor, dim),
dt => panic!("int_cummax: unsupported dtype {:?}", dt),
}
}
fn int_argmax(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex> {
crate::ops::reduce::argmax(tensor, dim)
}
fn int_argmin(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex> {
crate::ops::reduce::argmin(tensor, dim)
}
fn int_abs(tensor: IntTensor<Flex>) -> IntTensor<Flex> {
crate::ops::unary::int_abs(tensor)
}
fn bitwise_and(lhs: IntTensor<Flex>, rhs: IntTensor<Flex>) -> IntTensor<Flex> {
int_binary_op(lhs, rhs, |a, b| a & b)
}View on GitHub (pinned to d16f7ba2ed)
Solutions
- Check the dtype before the call and cast to an integer dtype if the values are logically integer.
- Use the float reduce path (max_dim / cumulative max on floats) for float tensors.
- Pin dtypes with explicit .cast::<i64>() calls after dtype-promoting operations.
- Add dtype assertions in tests covering the affected pipeline.
Example fix
// before let out = t.cummax(dim); // t is F64 -> panic // after let out_i = t.cast::<i64>(); let out = out_i.cummax(dim);
Defensive patterns
Strategy: validation
Validate before calling
assert!(t.dtype().is_int(), "cummax requires an int tensor, got {:?}", t.dtype()); Type guard
fn is_int_tensor(t: &FlexTensor) -> bool { matches!(t.dtype(), DType::I64 | DType::I32 | DType::I16 | DType::I8 | DType::U64 | DType::U32 | DType::U16 | DType::U8) } Prevention
- Cast to i64 before cummax when dtype is uncertain
- Pin dtypes after dtype-promoting operations
- Cover cumulative ops with dtype-assertion unit tests
When it happens
Trigger: Calling cummax (int_cummax) on a Flex tensor with dtype F32/F64/F16/BF16 or Bool.
Common situations: Framework ports where cummax handles all dtypes; tensors promoted to float by a previous op (division, cast); data loaders inferring float dtype for integer columns.
Related errors
- float_cummax: unsupported dtype {:?}
- burn-flex does not support Bool(U32) storage (only Native an
- compare_int: unsupported dtype {:?}
- compare_int_elem: unsupported dtype {:?}
- any_float: unsupported dtype {:?}
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/d4f681c1d356ddac.
Report an issue: GitHub.