{"record":{"id":"7f4fe28de4f9990b","repo":"tracel-ai/burn","slug":"int-scatter-with-other-update-is-not-implement-7f4fe2","errorCode":null,"errorMessage":"int_scatter with {other:?} update is not implemented","messagePattern":"int_scatter with (.+?) update is not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-tch/src/ops/int_tensor.rs","lineNumber":303,"sourceCode":"\n    fn int_scatter(\n        dim: usize,\n        tensor: TchTensor,\n        indices: TchTensor,\n        value: TchTensor,\n        update: burn_backend::tensor::IndexingUpdateOp,\n    ) -> TchTensor {\n        match update {\n            burn_backend::tensor::IndexingUpdateOp::Assign => {\n                TchOps::scatter_assign(dim, tensor, indices, value)\n            }\n            burn_backend::tensor::IndexingUpdateOp::Add => {\n                TchOps::scatter(dim, tensor, indices, value)\n            }\n            burn_backend::tensor::IndexingUpdateOp::Mul => {\n                TchOps::scatter_mul(dim, tensor, indices, value)\n            }\n            other => unimplemented!(\"int_scatter with {other:?} update is not implemented\"),\n        }\n    }\n\n    fn int_scatter_nd(\n        data: TchTensor,\n        indices: TchTensor,\n        values: TchTensor,\n        reduction: burn_backend::tensor::IndexingUpdateOp,\n    ) -> TchTensor {\n        TchOps::scatter_nd(data, indices, values, reduction)\n    }\n\n    fn int_gather_nd(data: TchTensor, indices: TchTensor) -> TchTensor {\n        TchOps::gather_nd(data, indices)\n    }\n\n    fn int_select(tensor: TchTensor, dim: usize, indices: TchTensor) -> TchTensor {\n        TchOps::index_select_dim(tensor, dim, indices)","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-tch/src/ops/int_tensor.rs#L285-L321","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\ntensor.scatter(dim, indices, value, IndexingUpdateOp::Sub);\n\n// after\ntensor.scatter(dim, indices, -value, IndexingUpdateOp::Add); // emulate Sub via Add of negation","handlingStrategy":"validation","validationCode":"match op {\n    IndexingUpdateOp::Add | IndexingUpdateOp::Mul => { /* safe */ }\n    other => panic!(\"unsupported op {:?}, rewrite as Add/Mul\", other),\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["rust","burn","libtorch","tensor","scatter"],"backgroundTag":"unsupported-scatter-update-op","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"}