{"record":{"id":"1efea90c57280309","repo":"tracel-ai/burn","slug":"int-mask-fill-unsupported-dtype","errorCode":null,"errorMessage":"int_mask_fill: unsupported dtype {:?}","messagePattern":"int_mask_fill: unsupported dtype (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/int.rs","lineNumber":92,"sourceCode":"            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),\n        }\n    }\n\n    fn int_slice_assign(\n        tensor: IntTensor<Flex>,\n        slices: &[Slice],\n        value: IntTensor<Flex>,\n    ) -> IntTensor<Flex> {\n        crate::ops::slice::slice_assign(tensor, slices, value)\n    }\n\n    /// Gather ints along `dim` at the given indices.\n    ///\n    /// The `tensor` dispatches on its own int dtype (I8/I16/I32/I64 signed or\n    /// U8/U16/U32/U64 unsigned). The `indices` tensor may be any of those\n    /// widths too - it's normalised to `isize` by the shared `read_indices`\n    /// helper in `ops::gather_scatter` before the kernel runs, so callers are\n    /// not required to pre-convert to I64.","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/int.rs#L74-L110","documentation":"int_mask_fill fills masked positions of an integer tensor with a scalar value, converting the scalar to the tensor's dtype. If the tensor's dtype is not one of the supported integer types, the function panics with 'unsupported dtype'. Note the scalar conversion itself uses value.to_i64()/to_u64().unwrap(), so the dtype dispatch is the guard implemented here.","triggerScenarios":"Calling int_mask_fill on a tensor whose dtype is not I64/I32/I16/I8/U64/U32/U16/U8 — i.e. a float or bool tensor reached the int ops entry point.","commonSituations":"Float tensors incorrectly passed to the int ops API, generic pipelines where the dtype parameter changed at runtime, or confusion between mask_fill variants for float vs int tensors.","solutions":["Route float tensors to the float mask_fill op","Cast the tensor to an integer dtype before calling int_mask_fill","Assert tensor.dtype().is_int() (or equivalent) before the call","Trace where the tensor's dtype changed if it was expected to be an int tensor"],"exampleFix":"// before\nlet out = backend.int_mask_fill(f_tensor, mask, 3.0f32.into()); // panic: unsupported dtype F32\n// after\nlet out = backend.float_mask_fill(f_tensor, mask, 3.0f32.into());","handlingStrategy":"validation","validationCode":"// before calling int_mask_fill\nassert!(tensor.dtype().is_int(), \"int_mask_fill 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":["Route float tensors to the float mask_fill variant","Track dtype through the pipeline; assert before int-specific ops"],"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"}