{"record":{"id":"711f4950d29e263c","repo":"tracel-ai/burn","slug":"float-scatter-with-other-update-is-not-impleme-711f49","errorCode":null,"errorMessage":"float_scatter with {other:?} update is not implemented","messagePattern":"float_scatter with (.+?) update is not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/float.rs","lineNumber":338,"sourceCode":"                }\n                _ => panic!(\"float_scatter: unsupported dtype {:?}\", tensor.dtype()),\n            },\n            burn_backend::tensor::IndexingUpdateOp::Mul => match tensor.dtype() {\n                DType::F32 => {\n                    crate::ops::gather_scatter::scatter_mul::<f32>(tensor, dim, indices, value)\n                }\n                DType::F64 => {\n                    crate::ops::gather_scatter::scatter_mul::<f64>(tensor, dim, indices, value)\n                }\n                DType::F16 => {\n                    crate::ops::gather_scatter::scatter_mul::<f16>(tensor, dim, indices, value)\n                }\n                DType::BF16 => {\n                    crate::ops::gather_scatter::scatter_mul::<bf16>(tensor, dim, indices, value)\n                }\n                _ => panic!(\"float_scatter: unsupported dtype {:?}\", tensor.dtype()),\n            },\n            other => unimplemented!(\"float_scatter with {other:?} update is not implemented\"),\n        }\n    }\n\n    fn float_scatter_nd(\n        data: FloatTensor<Flex>,\n        indices: IntTensor<Flex>,\n        values: FloatTensor<Flex>,\n        reduction: burn_backend::tensor::IndexingUpdateOp,\n    ) -> FloatTensor<Flex> {\n        match data.dtype() {\n            DType::F32 => {\n                crate::ops::gather_scatter::scatter_nd::<f32>(data, indices, values, reduction)\n            }\n            DType::F64 => {\n                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)","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/float.rs#L320-L356","documentation":"burn-flex's `float_scatter` matches on the dtype category of the `value` (update) tensor. Float dtypes (F32/BF16, etc.) are supported, but any non-float update dtype falls into the `other` arm and panics with `unimplemented!(\"float_scatter with {other:?} update is not implemented\")`.","triggerScenarios":"Calling `Tensor::scatter` (or `float_scatter`) on a float tensor with an integer/bool `values` tensor as the update, instead of a float tensor of the same dtype.","commonSituations":"Passing an index/integer tensor as the update by mistake; results of an `arange` or comparison reused directly as scatter values; dtype mismatches after refactors.","solutions":["Cast the update tensor to the data tensor's float dtype first: `values.cast(DType::F32)` (or `.float()` on the Tensor API)","Ensure scatter values come from float ops, not int/bool ops","Check the dtype of `values` at the call site before scattering","Use `select_assign`/`scatter_nd` only with dtype-matched tensors"],"exampleFix":"// before\nlet updated = tensor.scatter(dim, indices, indices_i32);\n// after\nlet updated = tensor.scatter(dim, indices, indices_i32.cast(DType::F32));","handlingStrategy":"type-guard","validationCode":"assert_eq!(values.dtype(), tensor.dtype(), \"float_scatter update dtype must match data tensor dtype\");\ndebug_assert!(matches!(tensor.dtype(), DType::F32 | DType::F64 | DType::BF16 | DType::F16));","typeGuard":"fn is_float_update(t: &TensorData) -> bool {\n    matches!(t.dtype, DType::F32 | DType::F64 | DType::BF16 | DType::F16)\n}","tryCatchPattern":"// panics are not catchable in Rust; guard before call\nif !is_float_update(&values_data) {\n    values = values.cast(DType::F32);\n}\nlet out = tensor.scatter(dim, indices, values);","preventionTips":["Always match the update tensor dtype to the data tensor dtype for scatter","Cast int/bool results (.cast(DType::F32)) before using them as scatter values","Add dtype assertions in helper functions that wrap scatter","Enable debug asserts to catch mismatches in tests"],"tags":["rust","dtype","scatter","burn-flex"],"backgroundTag":"unsupported-scatter-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"}