{"record":{"id":"c6be9dbeb8a2c7b6","repo":"tracel-ai/burn","slug":"int-cumprod-unsupported-dtype","errorCode":null,"errorMessage":"int_cumprod: unsupported dtype {:?}","messagePattern":"int_cumprod: unsupported dtype (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/int.rs","lineNumber":710,"sourceCode":"            DType::U64 => crate::ops::cumulative::cumsum::<u64>(tensor, dim),\n            DType::U32 => crate::ops::cumulative::cumsum::<u32>(tensor, dim),\n            DType::U16 => crate::ops::cumulative::cumsum::<u16>(tensor, dim),\n            DType::U8 => crate::ops::cumulative::cumsum::<u8>(tensor, dim),\n            dt => panic!(\"int_cumsum: unsupported dtype {:?}\", dt),\n        }\n    }\n\n    fn int_cumprod(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex> {\n        match tensor.dtype() {\n            DType::I64 => crate::ops::cumulative::cumprod::<i64>(tensor, dim),\n            DType::I32 => crate::ops::cumulative::cumprod::<i32>(tensor, dim),\n            DType::I16 => crate::ops::cumulative::cumprod::<i16>(tensor, dim),\n            DType::I8 => crate::ops::cumulative::cumprod::<i8>(tensor, dim),\n            DType::U64 => crate::ops::cumulative::cumprod::<u64>(tensor, dim),\n            DType::U32 => crate::ops::cumulative::cumprod::<u32>(tensor, dim),\n            DType::U16 => crate::ops::cumulative::cumprod::<u16>(tensor, dim),\n            DType::U8 => crate::ops::cumulative::cumprod::<u8>(tensor, dim),\n            dt => panic!(\"int_cumprod: unsupported dtype {:?}\", dt),\n        }\n    }\n\n    fn int_cummin(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex> {\n        match tensor.dtype() {\n            DType::I64 => crate::ops::cumulative::cummin::<i64>(tensor, dim),\n            DType::I32 => crate::ops::cumulative::cummin::<i32>(tensor, dim),\n            DType::I16 => crate::ops::cumulative::cummin::<i16>(tensor, dim),\n            DType::I8 => crate::ops::cumulative::cummin::<i8>(tensor, dim),\n            DType::U64 => crate::ops::cumulative::cummin::<u64>(tensor, dim),\n            DType::U32 => crate::ops::cumulative::cummin::<u32>(tensor, dim),\n            DType::U16 => crate::ops::cumulative::cummin::<u16>(tensor, dim),\n            DType::U8 => crate::ops::cumulative::cummin::<u8>(tensor, dim),\n            dt => panic!(\"int_cummin: unsupported dtype {:?}\", dt),\n        }\n    }\n\n    fn int_cummax(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex> {","sourceCodeStart":692,"sourceCodeEnd":728,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/int.rs#L692-L728","documentation":"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.","triggerScenarios":"Calling cumprod (Tensor::cumprod / int_cumprod) on a Flex tensor with dtype F32/F64/F16/BF16 or Bool.","commonSituations":"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.","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."],"exampleFix":"// before\nlet out = t.cumprod(dim); // t is F32 -> panic\n// after\nlet out_i = t.cast::<i64>();\nlet out = out_i.cumprod(dim);","handlingStrategy":"validation","validationCode":"assert!(t.dtype().is_int(), \"cumprod requires an int tensor, got {:?}\", t.dtype());","typeGuard":"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) }","tryCatchPattern":null,"preventionTips":["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"],"tags":["rust","burn","dtype","cumprod"],"backgroundTag":"unsupported-dtype-for-op","analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}