tracel-ai/burn · error
float_scatter with {other:?} update is not implemented
Error message
float_scatter with {other:?} update is not implemented What it means
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")`.
Source
Thrown at crates/burn-flex/src/ops/float.rs:338
}
_ => panic!("float_scatter: unsupported dtype {:?}", tensor.dtype()),
},
burn_backend::tensor::IndexingUpdateOp::Mul => match tensor.dtype() {
DType::F32 => {
crate::ops::gather_scatter::scatter_mul::<f32>(tensor, dim, indices, value)
}
DType::F64 => {
crate::ops::gather_scatter::scatter_mul::<f64>(tensor, dim, indices, value)
}
DType::F16 => {
crate::ops::gather_scatter::scatter_mul::<f16>(tensor, dim, indices, value)
}
DType::BF16 => {
crate::ops::gather_scatter::scatter_mul::<bf16>(tensor, dim, indices, value)
}
_ => panic!("float_scatter: unsupported dtype {:?}", tensor.dtype()),
},
other => unimplemented!("float_scatter with {other:?} update is not implemented"),
}
}
fn float_scatter_nd(
data: FloatTensor<Flex>,
indices: IntTensor<Flex>,
values: FloatTensor<Flex>,
reduction: burn_backend::tensor::IndexingUpdateOp,
) -> FloatTensor<Flex> {
match data.dtype() {
DType::F32 => {
crate::ops::gather_scatter::scatter_nd::<f32>(data, indices, values, reduction)
}
DType::F64 => {
crate::ops::gather_scatter::scatter_nd::<f64>(data, indices, values, reduction)
}
DType::F16 => {
crate::ops::gather_scatter::scatter_nd::<f16>(data, indices, values, reduction)View on GitHub (pinned to d16f7ba2ed)
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
Example fix
// before let updated = tensor.scatter(dim, indices, indices_i32); // after let updated = tensor.scatter(dim, indices, indices_i32.cast(DType::F32));
Defensive patterns
Strategy: type-guard
Validate before calling
assert_eq!(values.dtype(), tensor.dtype(), "float_scatter update dtype must match data tensor dtype"); debug_assert!(matches!(tensor.dtype(), DType::F32 | DType::F64 | DType::BF16 | DType::F16));
Type guard
fn is_float_update(t: &TensorData) -> bool {
matches!(t.dtype, DType::F32 | DType::F64 | DType::BF16 | DType::F16)
} Try / catch
// panics are not catchable in Rust; guard before call
if !is_float_update(&values_data) {
values = values.cast(DType::F32);
}
let out = tensor.scatter(dim, indices, values); Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- int_scatter: unsupported dtype {:?}
- int_scatter with {other:?} update is not implemented
- float_scatter: unsupported dtype {:?}
- int_gather: unsupported dtype {:?}
- int_scatter_nd: unsupported dtype {:?}
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/711f4950d29e263c.
Report an issue: GitHub.