tracel-ai/burn · error
int_scatter with {other:?} update is not implemented
Error message
int_scatter with {other:?} update is not implemented What it means
int_scatter in burn-tch handles only IndexingUpdateOp::Add and IndexingUpdateOp::Mul update operations via TchOps::scatter/scatter_mul. Any other IndexingUpdateOp variant passed in falls through to unimplemented!() and panics, naming the unsupported op.
Source
Thrown at crates/burn-tch/src/ops/int_tensor.rs:303
fn int_scatter(
dim: usize,
tensor: TchTensor,
indices: TchTensor,
value: TchTensor,
update: burn_backend::tensor::IndexingUpdateOp,
) -> TchTensor {
match update {
burn_backend::tensor::IndexingUpdateOp::Assign => {
TchOps::scatter_assign(dim, tensor, indices, value)
}
burn_backend::tensor::IndexingUpdateOp::Add => {
TchOps::scatter(dim, tensor, indices, value)
}
burn_backend::tensor::IndexingUpdateOp::Mul => {
TchOps::scatter_mul(dim, tensor, indices, value)
}
other => unimplemented!("int_scatter with {other:?} update is not implemented"),
}
}
fn int_scatter_nd(
data: TchTensor,
indices: TchTensor,
values: TchTensor,
reduction: burn_backend::tensor::IndexingUpdateOp,
) -> TchTensor {
TchOps::scatter_nd(data, indices, values, reduction)
}
fn int_gather_nd(data: TchTensor, indices: TchTensor) -> TchTensor {
TchOps::gather_nd(data, indices)
}
fn int_select(tensor: TchTensor, dim: usize, indices: TchTensor) -> TchTensor {
TchOps::index_select_dim(tensor, dim, indices)View on GitHub (pinned to d16f7ba2ed)
Solutions
- Use the supported Add or Mul update ops for scatter on LibTorch
- Emulate the desired update manually: mask_where / select_assign with arithmetic built from supported ops
- Implement the missing variant with existing torch scatter primitives (e.g. scatter_add on negated values for Sub)
- Upgrade burn to a version that maps the op you need
Example fix
// before tensor.scatter(dim, indices, value, IndexingUpdateOp::Sub); // after tensor.scatter(dim, indices, -value, IndexingUpdateOp::Add); // emulate Sub via Add of negation
Defensive patterns
Strategy: validation
Validate before calling
match op {
IndexingUpdateOp::Add | IndexingUpdateOp::Mul => { /* safe */ }
other => panic!("unsupported op {:?}, rewrite as Add/Mul", other),
} Prevention
- Restrict scatter updates to Add/Mul on the LibTorch backend
- Emulate other updates (e.g. Sub via Add of negated value) before calling
- Check IndexingUpdateOp variant coverage when upgrading burn versions
When it happens
Trigger: Calling scatter on an integer tensor with a LibTorch backend using an update op other than Add or Mul (e.g. a Sub/Max/Min variant of IndexingUpdateOp).
Common situations: Using higher-level indexing/assign APIs where the update op is configurable; code ported from a backend that supports more scatter update ops; Burn upgrades introducing new IndexingUpdateOp variants not yet wired into tch.
Related errors
- Unsupported dtype for `bool_from_data`
- Unsupported dtype for `int_from_data`: {:?}
- int_select_assign with {other:?} update is not implemented
- Operation not marked for autodiff.
- Cannot move a tensor from a capture device
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/7f4fe28de4f9990b.
Report an issue: GitHub.