{"record":{"id":"d4f681c1d356ddac","repo":"tracel-ai/burn","slug":"int-cummax-unsupported-dtype","errorCode":null,"errorMessage":"int_cummax: unsupported dtype {:?}","messagePattern":"int_cummax: unsupported dtype (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/int.rs","lineNumber":738,"sourceCode":"            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> {\n        match tensor.dtype() {\n            DType::I64 => crate::ops::cumulative::cummax::<i64>(tensor, dim),\n            DType::I32 => crate::ops::cumulative::cummax::<i32>(tensor, dim),\n            DType::I16 => crate::ops::cumulative::cummax::<i16>(tensor, dim),\n            DType::I8 => crate::ops::cumulative::cummax::<i8>(tensor, dim),\n            DType::U64 => crate::ops::cumulative::cummax::<u64>(tensor, dim),\n            DType::U32 => crate::ops::cumulative::cummax::<u32>(tensor, dim),\n            DType::U16 => crate::ops::cumulative::cummax::<u16>(tensor, dim),\n            DType::U8 => crate::ops::cumulative::cummax::<u8>(tensor, dim),\n            dt => panic!(\"int_cummax: unsupported dtype {:?}\", dt),\n        }\n    }\n\n    fn int_argmax(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex> {\n        crate::ops::reduce::argmax(tensor, dim)\n    }\n\n    fn int_argmin(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex> {\n        crate::ops::reduce::argmin(tensor, dim)\n    }\n\n    fn int_abs(tensor: IntTensor<Flex>) -> IntTensor<Flex> {\n        crate::ops::unary::int_abs(tensor)\n    }\n\n    fn bitwise_and(lhs: IntTensor<Flex>, rhs: IntTensor<Flex>) -> IntTensor<Flex> {\n        int_binary_op(lhs, rhs, |a, b| a & b)\n    }","sourceCodeStart":720,"sourceCodeEnd":756,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/int.rs#L720-L756","documentation":"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.","triggerScenarios":"Calling cummax (int_cummax) on a Flex tensor with dtype F32/F64/F16/BF16 or Bool.","commonSituations":"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.","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."],"exampleFix":"// before\nlet out = t.cummax(dim); // t is F64 -> panic\n// after\nlet out_i = t.cast::<i64>();\nlet out = out_i.cummax(dim);","handlingStrategy":"validation","validationCode":"assert!(t.dtype().is_int(), \"cummax 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 cummax when dtype is uncertain","Pin dtypes after dtype-promoting operations","Cover cumulative ops with dtype-assertion unit tests"],"tags":["rust","burn","dtype","cummax"],"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"}