tf.keras.ops.scatter
Stay organized with collections
Save and categorize content based on your preferences.
Returns a tensor of shape shape
where indices
are set to values
.
tf.keras.ops.scatter(
indices, values, shape
)
At a high level, this operation does zeros[indices] = updates
and
returns the output. It is equivalent to:
zeros = keras.ops.zeros(shape)
output = keras.ops.scatter_update(zeros, indices, values)
Args |
indices
|
A tensor or list/tuple specifying
indices for the values in values .
|
values
|
A tensor, the values to be set at indices .
|
shape
|
Shape of the output tensor.
|
Example:
indices = [[0, 1], [1, 1]]
values = np.array([1., 1.])
keras.ops.scatter(indices, values, shape=(2, 2))
array([[0., 1.],
[0., 1.]])
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. Some content is licensed under the numpy license.
Last updated 2024-06-07 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 2024-06-07 UTC."],[],[]]