{"record":{"id":"a211e61792c1fa1b","repo":"tracel-ai/burn","slug":"int-select-unsupported-dtype","errorCode":null,"errorMessage":"int_select: unsupported dtype {:?}","messagePattern":"int_select: unsupported dtype (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/int.rs","lineNumber":298,"sourceCode":"    /// Select ints along `dim` by a 1D index tensor.\n    ///\n    /// The `indices` tensor may be any supported int width. See\n    /// [`int_gather`](Self::int_gather) for the full index-width policy.\n    fn int_select(\n        tensor: IntTensor<Flex>,\n        dim: usize,\n        indices: IntTensor<Flex>,\n    ) -> IntTensor<Flex> {\n        match tensor.dtype() {\n            DType::I64 => crate::ops::gather_scatter::select::<i64>(tensor, dim, indices),\n            DType::I32 => crate::ops::gather_scatter::select::<i32>(tensor, dim, indices),\n            DType::I16 => crate::ops::gather_scatter::select::<i16>(tensor, dim, indices),\n            DType::I8 => crate::ops::gather_scatter::select::<i8>(tensor, dim, indices),\n            DType::U64 => crate::ops::gather_scatter::select::<u64>(tensor, dim, indices),\n            DType::U32 => crate::ops::gather_scatter::select::<u32>(tensor, dim, indices),\n            DType::U16 => crate::ops::gather_scatter::select::<u16>(tensor, dim, indices),\n            DType::U8 => crate::ops::gather_scatter::select::<u8>(tensor, dim, indices),\n            dt => panic!(\"int_select: unsupported dtype {:?}\", dt),\n        }\n    }\n\n    fn int_select_assign(\n        tensor: IntTensor<Flex>,\n        dim: usize,\n        indices: IntTensor<Flex>,\n        value: IntTensor<Flex>,\n        update: burn_backend::tensor::IndexingUpdateOp,\n    ) -> IntTensor<Flex> {\n        match update {\n            burn_backend::tensor::IndexingUpdateOp::Assign => {\n                debug_assert_eq!(\n                    tensor.dtype(),\n                    value.dtype(),\n                    \"int_select_assign: dtype mismatch\"\n                );\n                match tensor.dtype() {","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/int.rs#L280-L316","documentation":"int_select dispatches dtype-based selection along a dimension and panics when the tensor dtype is not one of the eight implemented integer widths. Like gather, select copies fixed-width elements; unsupported dtypes are rejected with a fail-fast panic to avoid undefined behavior.","triggerScenarios":"Calling int_select (select by 1D index tensor along dim) on an IntTensor whose dtype is outside i64/i32/i16/i8/u64/u32/u16/u8, e.g. a bool tensor from a mask computation.","commonSituations":"Selecting slices of tensors produced by comparison ops, dtype inference yielding float/bool where ints were expected, or new upstream DType variants missing from burn-flex.","solutions":["Cast the tensor to a supported int dtype before select","Fix upstream type flow so bool/float tensors do not reach int selection ops","Use indices of any int width - only the data dtype must be an implemented int type","Add a select match arm for any newly added DType variant"],"exampleFix":"// before\nlet picked = tensor.select(dim, indices); // tensor is DType::Bool\n// after\nlet picked = tensor.cast(DType::I64).select(dim, indices);","handlingStrategy":"validation","validationCode":"assert!(is_supported_int_dtype(tensor.dtype()), \"select: unsupported dtype {:?}\", tensor.dtype());","typeGuard":"fn is_supported_int_dtype(dt: burn::tensor::DType) -> bool {\n    matches!(\n        dt,\n        burn::tensor::DType::I64 | burn::tensor::DType::I32\n            | burn::tensor::DType::I16 | burn::tensor::DType::I8\n            | burn::tensor::DType::U64 | burn::tensor::DType::U32\n            | burn::tensor::DType::U16 | burn::tensor::DType::U8\n    )\n}","tryCatchPattern":null,"preventionTips":["Cast to DType::I64 (or another int width) before select when dtype is uncertain","Avoid passing comparison/mask outputs directly into select","Assert integral dtype in wrappers around select","Track burn releases for new DType variants needing match arms"],"tags":["rust","dtype","panic","select","burn-flex"],"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"}