{"record":{"id":"8581b77f124558e0","repo":"tracel-ai/burn","slug":"int-mask-where-unsupported-dtype","errorCode":null,"errorMessage":"int_mask_where: unsupported dtype {:?}","messagePattern":"int_mask_where: unsupported dtype (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/int.rs","lineNumber":74,"sourceCode":"        tensor: IntTensor<Flex>,\n        mask: BoolTensor<Flex>,\n        value: IntTensor<Flex>,\n    ) -> IntTensor<Flex> {\n        debug_assert_eq!(\n            tensor.dtype(),\n            value.dtype(),\n            \"int_mask_where: dtype mismatch\"\n        );\n        match tensor.dtype() {\n            DType::I64 => crate::ops::mask::mask_where::<i64>(tensor, mask, value),\n            DType::I32 => crate::ops::mask::mask_where::<i32>(tensor, mask, value),\n            DType::I16 => crate::ops::mask::mask_where::<i16>(tensor, mask, value),\n            DType::I8 => crate::ops::mask::mask_where::<i8>(tensor, mask, value),\n            DType::U64 => crate::ops::mask::mask_where::<u64>(tensor, mask, value),\n            DType::U32 => crate::ops::mask::mask_where::<u32>(tensor, mask, value),\n            DType::U16 => crate::ops::mask::mask_where::<u16>(tensor, mask, value),\n            DType::U8 => crate::ops::mask::mask_where::<u8>(tensor, mask, value),\n            dt => panic!(\"int_mask_where: unsupported dtype {:?}\", dt),\n        }\n    }\n\n    fn int_mask_fill(\n        tensor: IntTensor<Flex>,\n        mask: BoolTensor<Flex>,\n        value: Scalar,\n    ) -> IntTensor<Flex> {\n        match tensor.dtype() {\n            DType::I64 => crate::ops::mask::mask_fill(tensor, mask, value.to_i64().unwrap()),\n            DType::I32 => crate::ops::mask::mask_fill(tensor, mask, value.to_i64().unwrap() as i32),\n            DType::I16 => crate::ops::mask::mask_fill(tensor, mask, value.to_i64().unwrap() as i16),\n            DType::I8 => crate::ops::mask::mask_fill(tensor, mask, value.to_i64().unwrap() as i8),\n            DType::U64 => crate::ops::mask::mask_fill(tensor, mask, value.to_u64().unwrap()),\n            DType::U32 => crate::ops::mask::mask_fill(tensor, mask, value.to_u64().unwrap() as u32),\n            DType::U16 => crate::ops::mask::mask_fill(tensor, mask, value.to_u64().unwrap() as u16),\n            DType::U8 => crate::ops::mask::mask_fill(tensor, mask, value.to_u64().unwrap() as u8),\n            dt => panic!(\"int_mask_fill: unsupported dtype {:?}\", dt),","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/int.rs#L56-L92","documentation":"int_mask_where applies a boolean mask (mask_where) on integer tensors and dispatches on the tensor's dtype. All integer dtypes (I64..U8) are handled; any other dtype reaching this function panics, because masking is only implemented for the listed element types.","triggerScenarios":"Calling int_mask_where (the IntOps mask_where entry of the Flex backend) with a tensor whose dtype is not an integer — float or bool tensors routed here by mistake.","commonSituations":"Passing a float tensor to the int-specific ops API, generic code where a type parameter resolved to a non-int dtype at runtime, or backend dispatch bugs after refactors.","solutions":["Use the float backend's mask_where for float tensors instead of int_mask_where","Cast the tensor to an integer dtype if integer semantics are intended","Check generic call sites — the dtype must be one of I64, I32, I16, I8, U64, U32, U16, U8","Verify tensor provenance; a dtype swap earlier in the pipeline may route it here"],"exampleFix":"// before\nlet out = backend.int_mask_where(float_tensor, mask, value); // panic: unsupported dtype F32\n// after\nlet out = backend.float_mask_where(float_tensor, mask, value); // float op for float data","handlingStrategy":"validation","validationCode":"// before calling int_mask_where\nassert!(tensor.dtype().is_int(), \"int_mask_where requires an integer tensor, got {:?}\", tensor.dtype());","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 to float mask ops for float tensors at the call site","Assert dtype at API boundaries in generic code"],"tags":["panic","dtype-mismatch","masking","rust"],"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"}