tracel-ai/burn · error
int_cumprod: unsupported dtype {:?}
Error message
int_cumprod: unsupported dtype {:?} What it means
int_cumprod computes the cumulative product along a dimension, dispatching per integer dtype (I64..U8). The panic fires when the tensor dtype is not one of these integer types (float or bool), meaning a non-integer tensor reached the int cumulative-product path. It is a dtype-dispatch guard, not a data error.
Source
Thrown at crates/burn-flex/src/ops/int.rs:710
DType::U64 => crate::ops::cumulative::cumsum::<u64>(tensor, dim),
DType::U32 => crate::ops::cumulative::cumsum::<u32>(tensor, dim),
DType::U16 => crate::ops::cumulative::cumsum::<u16>(tensor, dim),
DType::U8 => crate::ops::cumulative::cumsum::<u8>(tensor, dim),
dt => panic!("int_cumsum: unsupported dtype {:?}", dt),
}
}
fn int_cumprod(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex> {
match tensor.dtype() {
DType::I64 => crate::ops::cumulative::cumprod::<i64>(tensor, dim),
DType::I32 => crate::ops::cumulative::cumprod::<i32>(tensor, dim),
DType::I16 => crate::ops::cumulative::cumprod::<i16>(tensor, dim),
DType::I8 => crate::ops::cumulative::cumprod::<i8>(tensor, dim),
DType::U64 => crate::ops::cumulative::cumprod::<u64>(tensor, dim),
DType::U32 => crate::ops::cumulative::cumprod::<u32>(tensor, dim),
DType::U16 => crate::ops::cumulative::cumprod::<u16>(tensor, dim),
DType::U8 => crate::ops::cumulative::cumprod::<u8>(tensor, dim),
dt => panic!("int_cumprod: unsupported dtype {:?}", dt),
}
}
fn int_cummin(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex> {
match tensor.dtype() {
DType::I64 => crate::ops::cumulative::cummin::<i64>(tensor, dim),
DType::I32 => crate::ops::cumulative::cummin::<i32>(tensor, dim),
DType::I16 => crate::ops::cumulative::cummin::<i16>(tensor, dim),
DType::I8 => crate::ops::cumulative::cummin::<i8>(tensor, dim),
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> {View on GitHub (pinned to d16f7ba2ed)
Solutions
- Check the tensor dtype before the call; cast to an integer dtype (e.g. i64) if the data is logically integer.
- Route float tensors to a float-compatible cumulative product implementation.
- Audit the preceding operations for implicit dtype promotion and pin dtypes with explicit casts.
- Add an upstream assert on dtype so the failure surfaces at the pipeline boundary.
Example fix
// before let out = t.cumprod(dim); // t is F32 -> panic // after let out_i = t.cast::<i64>(); let out = out_i.cumprod(dim);
Defensive patterns
Strategy: validation
Validate before calling
assert!(t.dtype().is_int(), "cumprod 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 cumprod when dtype is uncertain
- Pin dtypes with explicit casts after ops that may promote to float
- Write dtype-assertion tests for ported PyTorch code
When it happens
Trigger: Calling cumprod (Tensor::cumprod / int_cumprod) on a Flex tensor with dtype F32/F64/F16/BF16 or Bool.
Common situations: Porting PyTorch code where cumprod works on any dtype; a preceding op (mul, cast, division) silently promoted the tensor to float; deserialized tensors with unexpected dtype.
Related errors
- float_cumprod: 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/c6be9dbeb8a2c7b6.
Report an issue: GitHub.