# High rank indices (for each i, ..., j)
ref[indices[i, ..., j], ...] = updates[i, ..., j, ...]
This operation outputs ref after the update is done. This makes it easier to chain operations that need to use the reset value.
If values in ref is to be updated more than once, because there are duplicate entries in indices, the order at which the updates happen for each value is undefined.
Requires updates.shape = indices.shape + ref.shape[1:] or updates.shape = [].
See also tf.batch_scatter_update and tf.scatter_nd_update.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tensorflow::ops::ScatterUpdate Class Reference\n\ntensorflow::ops::ScatterUpdate\n==============================\n\n`#include \u003cstate_ops.h\u003e`\n\nApplies sparse updates to a variable reference.\n\nSummary\n-------\n\nThis operation computes\n\n\n```text\n # Scalar indices\n ref[indices, ...] = updates[...]\n```\n\n\u003cbr /\u003e\n\n\n```transact-sql\n # Vector indices (for each i)\n ref[indices[i], ...] = updates[i, ...]\n```\n\n\u003cbr /\u003e\n\n\n```text\n # High rank indices (for each i, ..., j)\n ref[indices[i, ..., j], ...] = updates[i, ..., j, ...]\n```\n\n\u003cbr /\u003e\n\nThis operation outputs `ref` after the update is done. This makes it easier to chain operations that need to use the reset value.\n\nIf values in `ref` is to be updated more than once, because there are duplicate entries in `indices`, the order at which the updates happen for each value is undefined.\n\nRequires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`.\n\n\n\u003cbr /\u003e\n\nSee also `tf.batch_scatter_update` and `tf.scatter_nd_update`.\n\nArgs:\n\n- scope: A [Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- ref: Should be from a [Variable](/versions/r2.14/api_docs/cc/class/tensorflow/ops/variable#classtensorflow_1_1ops_1_1_variable) node.\n- indices: A tensor of indices into the first dimension of `ref`.\n- updates: A tensor of updated values to store in `ref`.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/scatter-update/attrs#structtensorflow_1_1ops_1_1_scatter_update_1_1_attrs)):\n\n- use_locking: If True, the assignment will be protected by a lock; otherwise the behavior is undefined, but may exhibit less contention.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.14/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): = Same as `ref`. Returned as a convenience for operations that want to use the updated values after the update is done.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [ScatterUpdate](#classtensorflow_1_1ops_1_1_scatter_update_1af11a28f7f16034316972ca7af5300091)`(const ::`[tensorflow::Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` ref, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` indices, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` updates)` ||\n| [ScatterUpdate](#classtensorflow_1_1ops_1_1_scatter_update_1a24930d0359067d34acd2eb9909cb7284)`(const ::`[tensorflow::Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` ref, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` indices, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` updates, const `[ScatterUpdate::Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/scatter-update/attrs#structtensorflow_1_1ops_1_1_scatter_update_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|---------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_scatter_update_1a947a92603c1a76d79f820bcfbd770085) | [Operation](/versions/r2.14/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output_ref](#classtensorflow_1_1ops_1_1_scatter_update_1a3393017bac00574a56c1e9dbfa571e13) | `::`[tensorflow::Output](/versions/r2.14/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|--------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_scatter_update_1ae8ab84fd6c4d480a1e0d0f7b5ddf0511)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_scatter_update_1a001e1fa15db57c166861b2299d0eb2dc)`() const ` | |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_scatter_update_1a06922deb16980eff51b1ca3d6474285a)`() const ` | |\n\n| ### Public static functions ||\n|-------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|\n| [UseLocking](#classtensorflow_1_1ops_1_1_scatter_update_1a2c494808116c7f942974b90f363d323f)`(bool x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/scatter-update/attrs#structtensorflow_1_1ops_1_1_scatter_update_1_1_attrs) |\n\n| ### Structs ||\n|-----------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::ScatterUpdate::Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/scatter-update/attrs) | Optional attribute setters for [ScatterUpdate](/versions/r2.14/api_docs/cc/class/tensorflow/ops/scatter-update#classtensorflow_1_1ops_1_1_scatter_update). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output_ref\n\n```scdoc\n::tensorflow::Output output_ref\n``` \n\nPublic functions\n----------------\n\n### ScatterUpdate\n\n```gdscript\n ScatterUpdate(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input ref,\n ::tensorflow::Input indices,\n ::tensorflow::Input updates\n)\n``` \n\n### ScatterUpdate\n\n```gdscript\n ScatterUpdate(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input ref,\n ::tensorflow::Input indices,\n ::tensorflow::Input updates,\n const ScatterUpdate::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### UseLocking\n\n```text\nAttrs UseLocking(\n bool x\n)\n```"]]