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

burn-cubecl's int_scatter only implements IndexingUpdateOp::Add (kernel::scatter) and IndexingUpdateOp::Mul (kernel::scatter_mul) for updating scattered values on integer tensors. Any other IndexingUpdateOp variant (e.g. Sub) reaches the catch-all `other` arm and panics via unimplemented!. The operation is simply not yet implemented for this CubeCl int-tensor backend.

Source

Thrown at crates/burn-cubecl/src/ops/int_tensor.rs:140

    fn int_scatter(
        dim: usize,
        tensor: IntTensor<Self>,
        indices: IntTensor<Self>,
        value: IntTensor<Self>,
        update: burn_backend::tensor::IndexingUpdateOp,
    ) -> IntTensor<Self> {
        match update {
            burn_backend::tensor::IndexingUpdateOp::Assign => {
                kernel::scatter_assign(dim, tensor, indices, value)
            }
            burn_backend::tensor::IndexingUpdateOp::Add => {
                kernel::scatter(dim, tensor, indices, value, false)
            }
            burn_backend::tensor::IndexingUpdateOp::Mul => {
                kernel::scatter_mul(dim, tensor, indices, value)
            }
            other => unimplemented!("int_scatter with {other:?} update is not implemented"),
        }
    }

    fn int_scatter_nd(
        data: IntTensor<Self>,
        indices: IntTensor<Self>,
        values: IntTensor<Self>,
        reduction: burn_backend::tensor::IndexingUpdateOp,
    ) -> IntTensor<Self> {
        kernel::scatter_nd(data, indices, values, reduction)
    }

    fn int_gather_nd(data: IntTensor<Self>, indices: IntTensor<Self>) -> IntTensor<Self> {
        kernel::gather_nd(data, indices)
    }

    fn int_select(
        tensor: IntTensor<Self>,

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Rewrite the scatter update in terms of a supported op: perform scatter with Add/Mul, or emulate Sub by scattering the negated value with Add.
  2. Fall back to a scatter-then-arith pattern: clone the tensor, use slice_assign on computed index positions, or gather + build + scatter.
  3. Implement the missing arm in crates/burn-cubecl/src/ops/int_tensor.rs by adding an int kernel (e.g. kernel::scatter_sub) and contributing it upstream.
  4. Track the burn issue tracker for IndexingUpdateOp::Sub support on CubeCl backends.

Example fix

// before
let out = tensor.scatter(dim, indices, updates, IndexingUpdateOp::Sub);
// after (emulate Sub via Add of negated values)
let neg = -updates;
let out = tensor.scatter(dim, indices, neg, IndexingUpdateOp::Add);
Defensive patterns

Strategy: validation

Validate before calling

fn supports_scatter_op(op: &IndexingUpdateOp) -> bool {
    matches!(op, IndexingUpdateOp::Add | IndexingUpdateOp::Mul)
}
assert!(supports_scatter_op(&my_op), "int_scatter only supports Add/Mul on CubeCl");

Type guard

fn is_supported_update_op(op: &IndexingUpdateOp) -> bool {
    matches!(op, IndexingUpdateOp::Add | IndexingUpdateOp::Mul)
}

Prevention

When it happens

Trigger: Calling int_scatter (or a higher-level API like Tensor::scatter with an indexing update op) on an integer tensor with a CubeCl backend using any IndexingUpdateOp other than Add or Mul, e.g. IndexingUpdateOp::Sub.

Common situations: Porting float tensor scatter code that uses subtraction-based updates to int tensors; switching backends and discovering feature parity gaps; upgrading burn to a version where new IndexingUpdateOp variants were added but the CubeCl int path was not extended.

Related errors


AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05). Data as JSON: /api/errors/48835a6f0a048e5f. Report an issue: GitHub.