根据 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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
