{"record":{"id":"c61ab2a29fb13ddb","repo":"tracel-ai/burn","slug":"float-select-assign-unsupported-dtype","errorCode":null,"errorMessage":"float_select_assign: unsupported dtype {:?}","messagePattern":"float_select_assign: unsupported dtype (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/float.rs","lineNumber":410,"sourceCode":"        indices: IntTensor<Flex>,\n        value: FloatTensor<Flex>,\n        update: burn_backend::tensor::IndexingUpdateOp,\n    ) -> FloatTensor<Flex> {\n        match update {\n            burn_backend::tensor::IndexingUpdateOp::Assign => match tensor.dtype() {\n                DType::F32 => {\n                    crate::ops::gather_scatter::select_assign::<f32>(tensor, dim, indices, value)\n                }\n                DType::F64 => {\n                    crate::ops::gather_scatter::select_assign::<f64>(tensor, dim, indices, value)\n                }\n                DType::F16 => {\n                    crate::ops::gather_scatter::select_assign::<f16>(tensor, dim, indices, value)\n                }\n                DType::BF16 => {\n                    crate::ops::gather_scatter::select_assign::<bf16>(tensor, dim, indices, value)\n                }\n                _ => panic!(\n                    \"float_select_assign: unsupported dtype {:?}\",\n                    tensor.dtype()\n                ),\n            },\n            burn_backend::tensor::IndexingUpdateOp::Add => match tensor.dtype() {\n                DType::F32 => {\n                    crate::ops::gather_scatter::select_add::<f32>(tensor, dim, indices, value)\n                }\n                DType::F64 => {\n                    crate::ops::gather_scatter::select_add::<f64>(tensor, dim, indices, value)\n                }\n                DType::F16 => {\n                    crate::ops::gather_scatter::select_add::<f16>(tensor, dim, indices, value)\n                }\n                DType::BF16 => {\n                    crate::ops::gather_scatter::select_add::<bf16>(tensor, dim, indices, value)\n                }\n                _ => panic!(","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/float.rs#L392-L428","documentation":"float_select_assign's IndexingUpdateOp::Set branch dispatches select_assign per dtype and only handles F32/F64/F16/BF16. A non-float tensor in this update path triggers the catch-all panic. This mirrors the float_scatter guards for the select_assign op.","triggerScenarios":"Calling float_select_assign (Tensor::select_assign with Set semantics) on a tensor whose dtype is not a float type.","commonSituations":"Assigning selected slices into an int tensor via the float path; dtype drift from upstream ops or mixed-precision configs; a new DType variant missing from the match.","solutions":["Verify the tensor dtype is F32/F64/F16/BF16 before select_assign","Use the int/bool select_assign op for non-float tensors","Cast the tensor to a float dtype before assignment","Add the missing dispatch arm for a new DType"],"exampleFix":"// before: t is I32 -> panic on Set update\nlet t = t.select_assign(dim, indices, value, IndexingUpdateOp::Set);\n// after\nlet t = t.cast(FloatDType::F32).select_assign(dim, indices, value, IndexingUpdateOp::Set);","handlingStrategy":"type-guard","validationCode":"fn ensure_float_for_select_assign(dt: DType) -> Result<(), String> {\n    match dt {\n        DType::F32 | DType::F64 | DType::F16 | DType::BF16 => Ok(()),\n        other => Err(format!(\"float_select_assign requires a float 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 target tensor dtype before select_assign","Ensure the assigned value tensor matches the target dtype","Use int select_assign ops for integer targets","Audit every IndexingUpdateOp branch whenever new dtypes are added"],"tags":["rust","tensor","dtype","select-assign","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"}