{"record":{"id":"4f5249acffaad3b0","repo":"tracel-ai/burn","slug":"any-int-unsupported-dtype","errorCode":null,"errorMessage":"any_int: unsupported dtype {:?}","messagePattern":"any_int: unsupported dtype (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/comparison.rs","lineNumber":892,"sourceCode":"}\n\n/// Check if all elements along a dimension are non-zero (float tensors).\npub fn all_float_dim(tensor: FlexTensor, dim: usize, out_dtype: BoolDType) -> FlexTensor {\n    reduce_bool_dim(&tensor, dim, true, |a, b| a && b, out_dtype)\n}\n\n/// Check if any element is non-zero (int tensors).\npub fn any_int(tensor: FlexTensor, out_dtype: BoolDType) -> FlexTensor {\n    let has_any = match tensor.dtype() {\n        DType::I64 => iter_elements::<i64>(&tensor).any(|x| x != 0),\n        DType::I32 => iter_elements::<i32>(&tensor).any(|x| x != 0),\n        DType::I16 => iter_elements::<i16>(&tensor).any(|x| x != 0),\n        DType::I8 => iter_elements::<i8>(&tensor).any(|x| x != 0),\n        DType::U64 => iter_elements::<u64>(&tensor).any(|x| x != 0),\n        DType::U32 => iter_elements::<u32>(&tensor).any(|x| x != 0),\n        DType::U16 => iter_elements::<u16>(&tensor).any(|x| x != 0),\n        DType::U8 => iter_elements::<u8>(&tensor).any(|x| x != 0),\n        _ => panic!(\"any_int: unsupported dtype {:?}\", tensor.dtype()),\n    };\n    bool_scalar(has_any, out_dtype)\n}\n\n/// Check if any element along a dimension is non-zero (int tensors).\npub fn any_int_dim(tensor: FlexTensor, dim: usize, out_dtype: BoolDType) -> FlexTensor {\n    reduce_bool_dim_int(&tensor, dim, false, |a, b| a || b, out_dtype)\n}\n\n/// Check if all elements are non-zero (int tensors).\npub fn all_int(tensor: FlexTensor, out_dtype: BoolDType) -> FlexTensor {\n    let all = match tensor.dtype() {\n        DType::I64 => iter_elements::<i64>(&tensor).all(|x| x != 0),\n        DType::I32 => iter_elements::<i32>(&tensor).all(|x| x != 0),\n        DType::I16 => iter_elements::<i16>(&tensor).all(|x| x != 0),\n        DType::I8 => iter_elements::<i8>(&tensor).all(|x| x != 0),\n        DType::U64 => iter_elements::<u64>(&tensor).all(|x| x != 0),\n        DType::U32 => iter_elements::<u32>(&tensor).all(|x| x != 0),","sourceCodeStart":874,"sourceCodeEnd":910,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/comparison.rs#L874-L910","documentation":"Dtype-dispatch exhaustiveness panic: `any_int` covers all signed/unsigned integer dtypes; a float or bool tensor reaching this int any-reduction hits the fallback panic, indicating a misrouted op in the Flex backend's op table.","triggerScenarios":"Calling the public any_int(tensor, out_dtype) with a float (F32/F64/F16/BF16) or Bool tensor.","commonSituations":"Passing float tensors to the int variant by mistake; generic reduction helpers that don't branch on dtype family.","solutions":["Check the dtype and call any_float for float tensors instead","Cast the tensor to an integer dtype if int semantics are intended","Assert the dtype family before dispatching to any_int/any_float"],"exampleFix":"// before\nlet has_any = any_int(f32_tensor, BoolDType::Native);\n// after\nlet has_any = any_float(f32_tensor, BoolDType::Native);","handlingStrategy":"type-guard","validationCode":"if !matches!(t.dtype(), DType::I64|DType::I32|DType::I16|DType::I8|DType::U64|DType::U32|DType::U16|DType::U8) { /* route to any_float or cast */ }","typeGuard":"fn is_int_dtype(d: &DType) -> bool {\n    matches!(d, DType::I64|DType::I32|DType::I16|DType::I8|DType::U64|DType::U32|DType::U16|DType::U8)\n}","tryCatchPattern":null,"preventionTips":["Dispatch any_int/any_float by dtype family","Avoid passing floats to int reductions expecting truncation — it panics","Unit-test reduction helpers with both float and int tensors"],"tags":["rust","burn","dtype","reduction","panic"],"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"}