{"record":{"id":"89a2bfc91521c5af","repo":"tracel-ai/burn","slug":"int-scatter-nd-is-not-implemented-for-this-backend","errorCode":null,"errorMessage":"int_scatter_nd is not implemented for this backend","messagePattern":"int_scatter_nd is not implemented for this backend","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-backend/src/backend/ops/int_tensor.rs","lineNumber":209,"sourceCode":"    fn int_gather(dim: usize, tensor: IntTensor<B>, indices: IntTensor<B>) -> IntTensor<B>;\n\n    /// Scatter elements into a tensor using the specified update operation.\n    fn int_scatter(\n        dim: usize,\n        tensor: IntTensor<B>,\n        indices: IntTensor<B>,\n        value: IntTensor<B>,\n        update: IndexingUpdateOp,\n    ) -> IntTensor<B>;\n\n    /// Multi-dimensional scatter for int tensors.\n    fn int_scatter_nd(\n        _data: IntTensor<B>,\n        _indices: IntTensor<B>,\n        _values: IntTensor<B>,\n        _reduction: crate::tensor::IndexingUpdateOp,\n    ) -> IntTensor<B> {\n        unimplemented!(\"int_scatter_nd is not implemented for this backend\")\n    }\n\n    /// Multi-dimensional gather for int tensors.\n    fn int_gather_nd(_data: IntTensor<B>, _indices: IntTensor<B>) -> IntTensor<B> {\n        unimplemented!(\"int_gather_nd is not implemented for this backend\")\n    }\n\n    /// Select tensor elements along the given dimension corresponding to the given indices.\n    ///\n    /// # Arguments\n    ///\n    /// * `tensor` - The tensor.\n    /// * `dim` - The dimension to select from.\n    /// * `indices` - The indices.\n    ///\n    /// # Returns\n    ///\n    /// The tensor with the selected elements.","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-backend/src/backend/ops/int_tensor.rs#L191-L227","documentation":"`int_scatter_nd` is a default trait method for multi-dimensional scatter on int tensors; the default body panics with `unimplemented!(\"int_scatter_nd is not implemented for this backend\")`. The library throws it because the active backend did not override this optional op.","triggerScenarios":"Calling `int_scatter_nd(data, indices, values, reduction)` (e.g. via tensor scatter-nd operations on Int tensors) on a backend lacking the override.","commonSituations":"Porting models that use TF/ONNX-style `ScatterNd` on integer tensors; running inference/training on a minimal or fused backend that only implements core int ops.","solutions":["Switch to a backend that implements `int_scatter_nd`, or express the op with supported primitives (reshape + index_select/scatter along the last dim).","Implement `int_scatter_nd` in your backend.","Cast to Float and use `float_scatter_nd` if that backend provides it, then cast back."],"exampleFix":"// before\nlet out = B::int_scatter_nd(data, indices, values, IndexingUpdateOp::Update); // panics\n\n// after\n// flatten leading dims, use supported scatter/select primitives instead, e.g.\nlet flat = data.reshape(Shape::from([-1]));\nlet out = scatter_via_select(flat, indices, values).reshape(data.shape());","handlingStrategy":"validation","validationCode":"// Check backend support via capability/test before relying on scatter_nd on int tensors\n// e.g. run a probe in tests: B::int_scatter_nd(data.clone(), idx.clone(), vals.clone(), op);","typeGuard":null,"tryCatchPattern":"let out = std::panic::catch_unwind(|| B::int_scatter_nd(d, i, v, op))\n    .unwrap_or_else(|_| scatter_via_select_fallback(d, i, v, op));","preventionTips":["Consult the backend's supported-ops table before using optional ops like scatter_nd.","Prefer implementing ops from core primitives in portable fallback helpers.","Add unit tests that exercise scatter_nd per backend target in CI."],"tags":["rust","scatter","int-tensor","unimplemented-stub"],"backgroundTag":"backend-method-unimplemented","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"}