{"record":{"id":"d2f6bc0c659ed902","repo":"tracel-ai/burn","slug":"float-cummax-unsupported-dtype","errorCode":null,"errorMessage":"float_cummax: unsupported dtype {:?}","messagePattern":"float_cummax: unsupported dtype (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/float.rs","lineNumber":814,"sourceCode":"            }\n            DType::BF16 => {\n                crate::ops::cumulative::cummin_half(tensor, dim, bf16::to_f32, bf16::from_f32)\n            }\n            _ => panic!(\"float_cummin: unsupported dtype {:?}\", tensor.dtype()),\n        }\n    }\n\n    fn float_cummax(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex> {\n        match tensor.dtype() {\n            DType::F32 => crate::ops::cumulative::cummax_f32(tensor, dim),\n            DType::F64 => crate::ops::cumulative::cummax_f64(tensor, dim),\n            DType::F16 => {\n                crate::ops::cumulative::cummax_half(tensor, dim, f16::to_f32, f16::from_f32)\n            }\n            DType::BF16 => {\n                crate::ops::cumulative::cummax_half(tensor, dim, bf16::to_f32, bf16::from_f32)\n            }\n            _ => panic!(\"float_cummax: unsupported dtype {:?}\", tensor.dtype()),\n        }\n    }\n\n    fn float_cast(tensor: FloatTensor<Flex>, dtype: FloatDType) -> FloatTensor<Flex> {\n        use crate::Layout;\n        use burn_std::{Bytes, bf16, f16};\n\n        let src_dtype = tensor.dtype();\n        let target_dtype = DType::from(dtype);\n\n        // No-op if already the same dtype\n        if src_dtype == target_dtype {\n            return tensor;\n        }\n\n        let tensor = tensor.to_contiguous();\n        let shape = tensor.layout().shape().clone();\n","sourceCodeStart":796,"sourceCodeEnd":832,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/float.rs#L796-L832","documentation":"float_cummax computes the running maximum; F32/F64 use dedicated kernels and F16/BF16 go through cummax_half with f32 round-trip. The final match arm panics for any other dtype. As with the other cumulative ops, only float tensors are supported by this backend.","triggerScenarios":"Calling Tensor::cummax (running max along a dim) on burn-flex with an Int/Bool or otherwise non-float tensor.","commonSituations":"Running-max over integer scores or indices; code refactors that changed tensor kind; generic scan utilities instantiated with Int tensors.","solutions":["Cast the tensor to a float dtype before cummax, e.g. tensor.to_dtype(FloatDType::F32).","Check upstream ops (argmax, comparisons, casts) that may have produced an Int tensor.","Use the integer dispatch path if the backend exposes int cumulative ops, or implement one.","Add the required dtype arm to float_cummax in crates/burn-flex/src/ops/float.rs if needed."],"exampleFix":"// before\nlet m = scores_i64.cummax(0); // panic on Int\n// after\nlet m = scores_i64\n    .to_dtype(burn::tensor::FloatDType::F32)\n    .cummax(0);","handlingStrategy":"validation","validationCode":"assert!(matches!(tensor.dtype(), DType::F32 | DType::F64 | DType::F16 | DType::BF16), \"cummax needs a float tensor, got {:?}\", tensor.dtype());","typeGuard":"fn is_float_dtype(dtype: &DType) -> bool { matches!(dtype, DType::F32 | DType::F64 | DType::F16 | DType::BF16) }","tryCatchPattern":"// Validate dtype before calling; panics abort:\nif is_float_dtype(&tensor.dtype()) { let m = tensor.cummax(dim); }","preventionTips":["Cast to float after argmax/score-producing ops before running-max scans.","Use typed Tensor<B, D, Float> parameters in shared utilities.","Check dtype at pipeline boundaries with debug asserts.","Consult the burn-flex ops source for the supported dtype list per op."],"tags":["rust","dtype","panic","burn","cummax"],"backgroundTag":"unsupported-dtype","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"}