tracel-ai/burn · error

float_scatter_nd is not implemented for this backend

Error message

float_scatter_nd is not implemented for this backend

What it means

`float_scatter_nd` is a default trait method for multi-dimensional scatter on float tensors; its default body panics with `unimplemented!("float_scatter_nd is not implemented for this backend")`. The active backend has not overridden this optional op.

Source

Thrown at crates/burn-backend/src/backend/ops/tensor.rs:512

    /// Multi-dimensional scatter: update `data` at locations specified by `indices` with `values`.
    ///
    /// # Arguments
    ///
    /// * `data` - The tensor to scatter into.
    /// * `indices` - An M-dimensional integer tensor whose last dimension indexes into `data`.
    /// * `values` - The values to scatter.
    /// * `reduction` - How to combine with existing values.
    ///
    /// # Returns
    ///
    /// The tensor with scattered values.
    fn float_scatter_nd(
        _data: FloatTensor<B>,
        _indices: IntTensor<B>,
        _values: FloatTensor<B>,
        _reduction: crate::tensor::IndexingUpdateOp,
    ) -> FloatTensor<B> {
        unimplemented!("float_scatter_nd is not implemented for this backend")
    }

    /// Multi-dimensional gather: collect slices from `data` at locations specified by `indices`.
    ///
    /// # Arguments
    ///
    /// * `data` - The tensor to gather from.
    /// * `indices` - An M-dimensional integer tensor whose last dimension indexes into `data`.
    ///
    /// # Returns
    ///
    /// The gathered tensor.
    fn float_gather_nd(_data: FloatTensor<B>, _indices: IntTensor<B>) -> FloatTensor<B> {
        unimplemented!("float_gather_nd is not implemented for this backend")
    }

    /// Select tensor elements along the given dimension corresponding for the given indices.
    ///

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Switch to a backend that implements `float_scatter_nd`.
  2. Implement `float_scatter_nd` in your backend.
  3. Rewrite using supported ops: flatten data and use index-based select/scatter along a single dimension.

Example fix

// before
let out = B::float_scatter_nd(data, indices, updates, IndexingUpdateOp::Update); // panics

// after
// implement in backend or express via supported primitives:
fn float_scatter_nd(...) -> FloatTensor<Self> { /* real implementation */ }
Defensive patterns

Strategy: fallback

Validate before calling

// Confirm the target backend implements float_scatter_nd (check its source or capability list) before emitting the op

Try / catch

let out = std::panic::catch_unwind(|| B::float_scatter_nd(d, i, v, op))
    .unwrap_or_else(|_| float_scatter_nd_fallback(d, i, v, op));

Prevention

When it happens

Trigger: Calling `float_scatter_nd(data, indices, values, reduction)` (ScatterNd on Float tensors) on a backend lacking the override.

Common situations: Porting TF/ONNX models with `ScatterNd` updates (e.g. optimizer-side updates, embedding updates) to a minimal or fused backend.

Related errors


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