{"record":{"id":"c995b5c79f1ecd90","repo":"tracel-ai/burn","slug":"int-scatter-nd-unsupported-dtype","errorCode":null,"errorMessage":"int_scatter_nd: unsupported dtype {:?}","messagePattern":"int_scatter_nd: unsupported dtype (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/int.rs","lineNumber":262,"sourceCode":"            DType::I16 => {\n                crate::ops::gather_scatter::scatter_nd::<i16>(data, indices, values, reduction)\n            }\n            DType::I8 => {\n                crate::ops::gather_scatter::scatter_nd::<i8>(data, indices, values, reduction)\n            }\n            DType::U64 => {\n                crate::ops::gather_scatter::scatter_nd::<u64>(data, indices, values, reduction)\n            }\n            DType::U32 => {\n                crate::ops::gather_scatter::scatter_nd::<u32>(data, indices, values, reduction)\n            }\n            DType::U16 => {\n                crate::ops::gather_scatter::scatter_nd::<u16>(data, indices, values, reduction)\n            }\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.","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/int.rs#L244-L280","documentation":"int_scatter_nd dispatches scatter_nd updates by dtype and panics when the data tensor's dtype is not one of the eight implemented integer widths. N-dimensional scatter needs a concrete element type to write values; unknown dtypes are rejected fail-fast rather than written with wrong strides/widths.","triggerScenarios":"Calling int_scatter_nd with an IntTensor data tensor whose dtype is not i64/i32/i16/i8/u64/u32/u16/u8, e.g. a bool or float tensor routed into the int variant of scatter_nd.","commonSituations":"Building scatter_nd updates from boolean index computations, dtype inference yielding an unexpected width, or upstream burn adding a DType variant before burn-flex handles it.","solutions":["Cast the data (and values) tensor to a supported int dtype before calling int_scatter_nd","Ensure data and values share the same dtype","Verify you are using the int variant intentionally; float tensors should use the float scatter_nd path","Add the missing match arm calling crate::ops::gather_scatter::scatter_nd::<T> for new dtypes"],"exampleFix":"// before\nflex_int_scatter_nd(data, indices, values, reduction); // data is DType::Bool\n// after\nlet data = data.cast(DType::I64);\nlet values = values.cast(DType::I64);\nflex_int_scatter_nd(data, indices, values, reduction);","handlingStrategy":"validation","validationCode":"assert!(is_supported_int_dtype(data.dtype()), \"scatter_nd: unsupported dtype {:?}\", data.dtype());\nassert_eq!(data.dtype(), values.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 data and values to the same int dtype before scatter_nd","Route float data through the float scatter_nd variant instead","Validate dtype after every transformation that might change it","Check dtype coverage when upgrading burn or burn-flex versions"],"tags":["rust","dtype","panic","scatter-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"}