根據 indices
將 updates
分散到現有張量中。
用法
tf.raw_ops.TensorScatterUpdate(
tensor, indices, updates, name=None
)
參數
-
tensor
一個Tensor
。要複製/更新的張量。 -
indices
一個Tensor
。必須是以下類型之一:int32
,int64
。索引張量。 -
updates
一個Tensor
。必須與tensor
具有相同的類型。更新分散到輸出中。 -
name
操作的名稱(可選)。
返回
-
一個
Tensor
。具有與tensor
相同的類型。
此操作通過將稀疏的 updates
應用於傳入的 tensor
來創建一個新的張量。此操作與 tf.scatter_nd
非常相似,隻是更新分散在現有張量上(而不是 zero-tensor)。如果無法重新使用現有張量的內存,則製作並更新副本。
如果indices
包含重複項,那麽我們選擇索引的最後更新。
如果在 CPU 上發現超出範圍的索引,則返回錯誤。
警告:此操作有一些特定於 GPU 的語義。
- 如果發現超出範圍的索引,則忽略該索引。
- 應用更新的順序是不確定的,因此如果
indices
包含重複項,則輸出將是不確定的。
indices
是一個整數張量,其中包含指向形狀為 shape
的新張量的索引。
indices
必須至少有 2 個軸:(num_updates, index_depth)
。indices
的最後一個軸是索引到tensor
的深度,因此該索引深度必須小於tensor
的等級:indices.shape[-1] <= tensor.ndim
如果 indices.shape[-1] = tensor.rank
此操作索引並更新標量元素。如果 indices.shape[-1] < tensor.rank
它索引並更新輸入的切片 tensor
。
每個 update
的排名為 tensor.rank - indices.shape[-1]
。 updates
的整體形狀是:
indices.shape[:-1] + tensor.shape[indices.shape[-1]:]
有關用法示例,請參見 python tf.tensor_scatter_nd_update 函數
相關用法
- Python tf.raw_ops.TensorScatterMax用法及代碼示例
- Python tf.raw_ops.TensorScatterSub用法及代碼示例
- Python tf.raw_ops.TensorScatterAdd用法及代碼示例
- Python tf.raw_ops.TensorArrayConcatV3用法及代碼示例
- Python tf.raw_ops.TensorArraySplitV3用法及代碼示例
- Python tf.raw_ops.TPUReplicatedInput用法及代碼示例
- Python tf.raw_ops.Tanh用法及代碼示例
- Python tf.raw_ops.TakeManySparseFromTensorsMap用法及代碼示例
- Python tf.raw_ops.TopKV2用法及代碼示例
- Python tf.raw_ops.Tile用法及代碼示例
- Python tf.raw_ops.TPUReplicatedOutput用法及代碼示例
- Python tf.raw_ops.Tan用法及代碼示例
- Python tf.raw_ops.TopK用法及代碼示例
- Python tf.raw_ops.Bitcast用法及代碼示例
- Python tf.raw_ops.SelfAdjointEigV2用法及代碼示例
- Python tf.raw_ops.BatchMatMul用法及代碼示例
- Python tf.raw_ops.OneHot用法及代碼示例
- Python tf.raw_ops.ResourceScatterNdSub用法及代碼示例
- Python tf.raw_ops.ReadVariableXlaSplitND用法及代碼示例
- Python tf.raw_ops.GatherV2用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.raw_ops.TensorScatterUpdate。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。