Warning: This API is deprecated and will be removed in a future
version of TensorFlow after
the replacement is stable.
TensorScatterUpdate
Stay organized with collections
Save and categorize content based on your preferences.
Scatter `updates` into an existing tensor according to `indices`.
This operation creates a new tensor by applying sparse `updates` to the passed
in `tensor`.
This operation is very similar to tf.scatter_nd
, except that the updates are
scattered onto an existing tensor (as opposed to a zero-tensor). If the memory
for the existing tensor cannot be re-used, a copy is made and updated.
If `indices` contains duplicates, then we pick the last update for the index.
If an out of bound index is found on CPU, an error is returned.
WARNING: There are some GPU specific semantics for this operation.
- If an out of bound index is found, the index is ignored.
- The order in which updates are applied is nondeterministic, so the output
will be nondeterministic if `indices` contains duplicates.
`indices` is an integer tensor containing indices into a new tensor of shape
`shape`.
-
`indices` must have at least 2 axes: `(num_updates, index_depth)`.
-
The last axis of `indices` is how deep to index into `tensor` so this index
depth must be less than the rank of `tensor`: `indices.shape[-1] <= tensor.ndim`
if `indices.shape[-1] = tensor.rank` this Op indexes and updates scalar elements.
if `indices.shape[-1] < tensor.rank` it indexes and updates slices of the input
`tensor`.
Each `update` has a rank of `tensor.rank - indices.shape[-1]`.
The overall shape of `updates` is:
indices.shape[:-1] + tensor.shape[indices.shape[-1]:]
For usage examples see the python [tf.tensor_scatter_nd_update](
https://www.tensorflow.org/api_docs/python/tf/tensor_scatter_nd_update) function
Inherited Methods
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
Public Methods
public
Output<T>
asOutput
()
Returns the symbolic handle of a tensor.
Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is
used to obtain a symbolic handle that represents the computation of the input.
Factory method to create a class wrapping a new TensorScatterUpdate operation.
Parameters
scope |
current scope |
tensor |
Tensor to copy/update. |
indices |
Index tensor. |
updates |
Updates to scatter into output. |
Returns
- a new instance of TensorScatterUpdate
public
Output<T>
output
()
A new tensor with the given shape and updates applied according
to the indices.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-02-12 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-02-12 UTC."],[],[],null,["# TensorScatterUpdate\n\npublic final class **TensorScatterUpdate** \nScatter \\`updates\\` into an existing tensor according to \\`indices\\`.\n\n\nThis operation creates a new tensor by applying sparse \\`updates\\` to the passed\nin \\`tensor\\`.\nThis operation is very similar to [`tf.scatter_nd`](https://www.tensorflow.org/api_docs/python/tf/scatter_nd), except that the updates are\nscattered onto an existing tensor (as opposed to a zero-tensor). If the memory\nfor the existing tensor cannot be re-used, a copy is made and updated.\n\n\nIf \\`indices\\` contains duplicates, then we pick the last update for the index.\n\n\nIf an out of bound index is found on CPU, an error is returned.\n\n\n**WARNING**: There are some GPU specific semantics for this operation.\n- If an out of bound index is found, the index is ignored.\n- The order in which updates are applied is nondeterministic, so the output\nwill be nondeterministic if \\`indices\\` contains duplicates.\n\n\n\\`indices\\` is an integer tensor containing indices into a new tensor of shape\n\\`shape\\`.\n\n- \\`indices\\` must have at least 2 axes: \\`(num_updates, index_depth)\\`.\n- The last axis of \\`indices\\` is how deep to index into \\`tensor\\` so this index depth must be less than the rank of \\`tensor\\`: \\`indices.shape\\[-1\\] \\\u003c= tensor.ndim\\`\n\nif \\`indices.shape\\[-1\\] = tensor.rank\\` this Op indexes and updates scalar elements. if \\`indices.shape\\[-1\\] \\\u003c tensor.rank\\` it indexes and updates slices of the input \\`tensor\\`.\n\n\nEach \\`update\\` has a rank of \\`tensor.rank - indices.shape\\[-1\\]\\`.\nThe overall shape of \\`updates\\` is: \n\n indices.shape[:-1] + tensor.shape[indices.shape[-1]:]\n \nFor usage examples see the python \\[tf.tensor_scatter_nd_update\\]( https://www.tensorflow.org/api_docs/python/tf/tensor_scatter_nd_update) function\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### Public Methods\n\n|----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Output](/api_docs/java/org/tensorflow/Output)\\\u003cT\\\u003e | [asOutput](/api_docs/java/org/tensorflow/op/core/TensorScatterUpdate#asOutput())() Returns the symbolic handle of a tensor. |\n| static \\\u003cT, U extends Number\\\u003e [TensorScatterUpdate](/api_docs/java/org/tensorflow/op/core/TensorScatterUpdate)\\\u003cT\\\u003e | [create](/api_docs/java/org/tensorflow/op/core/TensorScatterUpdate#create(org.tensorflow.op.Scope,%20org.tensorflow.Operand\u003cT\u003e,%20org.tensorflow.Operand\u003cU\u003e,%20org.tensorflow.Operand\u003cT\u003e))([Scope](/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e tensor, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cU\\\u003e indices, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e updates) Factory method to create a class wrapping a new TensorScatterUpdate operation. |\n| [Output](/api_docs/java/org/tensorflow/Output)\\\u003cT\\\u003e | [output](/api_docs/java/org/tensorflow/op/core/TensorScatterUpdate#output())() A new tensor with the given shape and updates applied according to the indices. |\n\n### Inherited Methods\n\nFrom class [org.tensorflow.op.PrimitiveOp](/api_docs/java/org/tensorflow/op/PrimitiveOp) \n\n|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| final boolean | [equals](/api_docs/java/org/tensorflow/op/PrimitiveOp#equals(java.lang.Object))(Object obj) |\n| final int | [hashCode](/api_docs/java/org/tensorflow/op/PrimitiveOp#hashCode())() |\n| [Operation](/api_docs/java/org/tensorflow/Operation) | [op](/api_docs/java/org/tensorflow/op/PrimitiveOp#op())() Returns the underlying [Operation](/api_docs/java/org/tensorflow/Operation) |\n| final String | [toString](/api_docs/java/org/tensorflow/op/PrimitiveOp#toString())() |\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface [org.tensorflow.Operand](/api_docs/java/org/tensorflow/Operand) \n\n|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| abstract [Output](/api_docs/java/org/tensorflow/Output)\\\u003cT\\\u003e | [asOutput](/api_docs/java/org/tensorflow/Operand#asOutput())() Returns the symbolic handle of a tensor. |\n\nPublic Methods\n--------------\n\n#### public [Output](/api_docs/java/org/tensorflow/Output)\\\u003cT\\\u003e\n**asOutput**\n()\n\nReturns the symbolic handle of a tensor.\n\nInputs to TensorFlow operations are outputs of another TensorFlow operation. This method is\nused to obtain a symbolic handle that represents the computation of the input.\n\n\u003cbr /\u003e\n\n#### public static [TensorScatterUpdate](/api_docs/java/org/tensorflow/op/core/TensorScatterUpdate)\\\u003cT\\\u003e\n**create**\n([Scope](/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e tensor, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cU\\\u003e indices, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e updates)\n\nFactory method to create a class wrapping a new TensorScatterUpdate operation. \n\n##### Parameters\n\n| scope | current scope |\n| tensor | Tensor to copy/update. |\n| indices | Index tensor. |\n| updates | Updates to scatter into output. |\n|---------|---------------------------------|\n\n##### Returns\n\n- a new instance of TensorScatterUpdate \n\n#### public [Output](/api_docs/java/org/tensorflow/Output)\\\u003cT\\\u003e\n**output**\n()\n\nA new tensor with the given shape and updates applied according\nto the indices."]]