{"record":{"id":"c44c70961a21f6c1","repo":"tracel-ai/burn","slug":"float-gather-nd-unsupported-dtype","errorCode":null,"errorMessage":"float_gather_nd: unsupported dtype {:?}","messagePattern":"float_gather_nd: unsupported dtype (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/float.rs","lineNumber":371,"sourceCode":"                crate::ops::gather_scatter::scatter_nd::<f64>(data, indices, values, reduction)\n            }\n            DType::F16 => {\n                crate::ops::gather_scatter::scatter_nd::<f16>(data, indices, values, reduction)\n            }\n            DType::BF16 => {\n                crate::ops::gather_scatter::scatter_nd::<bf16>(data, indices, values, reduction)\n            }\n            _ => panic!(\"float_scatter_nd: unsupported dtype {:?}\", data.dtype()),\n        }\n    }\n\n    fn float_gather_nd(data: FloatTensor<Flex>, indices: IntTensor<Flex>) -> FloatTensor<Flex> {\n        match data.dtype() {\n            DType::F32 => crate::ops::gather_scatter::gather_nd::<f32>(data, indices),\n            DType::F64 => crate::ops::gather_scatter::gather_nd::<f64>(data, indices),\n            DType::F16 => crate::ops::gather_scatter::gather_nd::<f16>(data, indices),\n            DType::BF16 => crate::ops::gather_scatter::gather_nd::<bf16>(data, indices),\n            _ => panic!(\"float_gather_nd: unsupported dtype {:?}\", data.dtype()),\n        }\n    }\n\n    fn float_select(\n        tensor: FloatTensor<Flex>,\n        dim: usize,\n        indices: IntTensor<Flex>,\n    ) -> FloatTensor<Flex> {\n        match tensor.dtype() {\n            DType::F32 => crate::ops::gather_scatter::select::<f32>(tensor, dim, indices),\n            DType::F64 => crate::ops::gather_scatter::select::<f64>(tensor, dim, indices),\n            DType::F16 => crate::ops::gather_scatter::select::<f16>(tensor, dim, indices),\n            DType::BF16 => crate::ops::gather_scatter::select::<bf16>(tensor, dim, indices),\n            _ => panic!(\"float_select: unsupported dtype {:?}\", tensor.dtype()),\n        }\n    }\n\n    fn float_select_assign(","sourceCodeStart":353,"sourceCodeEnd":389,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/float.rs#L353-L389","documentation":"Dtype-dispatch exhaustiveness panic: `float_gather_nd` handles F32/F64/F16/BF16 and panics for any other dtype passed as the data tensor, implying an internal routing error where a non-float tensor reached the float gather_nd op.","triggerScenarios":"Calling float_gather_nd (Tensor::gather_nd) where the data tensor's dtype is Int or Bool instead of a float type.","commonSituations":"gather_nd on an integer label/indices tensor routed through the float path; upstream ops returning unexpected dtypes; new DType variants added without updating this match.","solutions":["Verify the data tensor is a float tensor before gather_nd","Use the int/bool gather_nd op for non-float data","Cast the data tensor to a float dtype first","Add the missing dispatch arm for a new DType"],"exampleFix":"// before: data is I32 -> panic\nlet out = data.gather_nd(indices);\n// after\nlet out = data.cast(FloatDType::F32).gather_nd(indices);","handlingStrategy":"type-guard","validationCode":"fn ensure_float_for_gather_nd(dt: DType) -> Result<(), String> {\n    match dt {\n        DType::F32 | DType::F64 | DType::F16 | DType::BF16 => Ok(()),\n        other => Err(format!(\"float_gather_nd requires a float data dtype, got {:?}\", other)),\n    }\n}","typeGuard":"fn is_float_dtype(dt: DType) -> bool {\n    matches!(dt, DType::F32 | DType::F64 | DType::F16 | DType::BF16)\n}","tryCatchPattern":null,"preventionTips":["Verify the data tensor dtype before gather_nd","Use int gather_nd for integer data tensors","Cast to a float dtype when a float gather is required","Keep dtype dispatch tables in sync with the DType enum"],"tags":["rust","tensor","dtype","gather-nd","panic"],"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"}