{"record":{"id":"16d718de94894483","repo":"tracel-ai/burn","slug":"int-gather-nd-unsupported-dtype","errorCode":null,"errorMessage":"int_gather_nd: unsupported dtype {:?}","messagePattern":"int_gather_nd: unsupported dtype (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/int.rs","lineNumber":276,"sourceCode":"            }\n            DType::U8 => {\n                crate::ops::gather_scatter::scatter_nd::<u8>(data, indices, values, reduction)\n            }\n            dt => panic!(\"int_scatter_nd: unsupported dtype {:?}\", dt),\n        }\n    }\n\n    fn int_gather_nd(data: IntTensor<Flex>, indices: IntTensor<Flex>) -> IntTensor<Flex> {\n        match data.dtype() {\n            DType::I64 => crate::ops::gather_scatter::gather_nd::<i64>(data, indices),\n            DType::I32 => crate::ops::gather_scatter::gather_nd::<i32>(data, indices),\n            DType::I16 => crate::ops::gather_scatter::gather_nd::<i16>(data, indices),\n            DType::I8 => crate::ops::gather_scatter::gather_nd::<i8>(data, indices),\n            DType::U64 => crate::ops::gather_scatter::gather_nd::<u64>(data, indices),\n            DType::U32 => crate::ops::gather_scatter::gather_nd::<u32>(data, indices),\n            DType::U16 => crate::ops::gather_scatter::gather_nd::<u16>(data, indices),\n            DType::U8 => crate::ops::gather_scatter::gather_nd::<u8>(data, indices),\n            dt => panic!(\"int_gather_nd: unsupported dtype {:?}\", dt),\n        }\n    }\n\n    /// 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),","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/int.rs#L258-L294","documentation":"int_gather_nd dispatches N-dimensional gathering by dtype and panics when the data tensor's dtype is not one of the eight implemented integer widths. gather_nd reads elements of a fixed width, so an unhandled dtype would corrupt memory; burn-flex panics instead.","triggerScenarios":"Calling int_gather_nd on an IntTensor whose dtype is not i64/i32/i16/i8/u64/u32/u16/u8, e.g. passing a bool or float tensor to the int gather_nd entry point.","commonSituations":"Gathering with index tensors computed from comparisons, dtype inference surprises, or a newly introduced burn DType not yet covered by burn-flex's match arms.","solutions":["Cast the data tensor to a supported int dtype (e.g. DType::I32) before calling int_gather_nd","Route float tensors through the float gather_nd implementation instead of the int one","Ensure index tensors are any supported int width - only data dtype must match the implemented arms","Add a gather_nd match arm for any missing DType variant in burn-flex"],"exampleFix":"// before\nlet out = tensor.gather_nd(indices); // tensor is DType::Bool\n// after\nlet out = tensor.cast(DType::I32).gather_nd(indices);","handlingStrategy":"validation","validationCode":"assert!(is_supported_int_dtype(data.dtype()), \"gather_nd: unsupported dtype {:?}\", data.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 the data tensor to an int dtype before gather_nd","Keep bool results of comparisons out of gather_nd data paths","Assert data.dtype() is integral in helper functions wrapping gather_nd","Recheck dtype inference after refactors that change tensor origins"],"tags":["rust","dtype","panic","gather-nd","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"}