对变量引用应用稀疏更新。
用法
tf.compat.v1.scatter_update(
ref, indices, updates, use_locking=True, name=None
)参数
-
ref一个Variable。 -
indices一个Tensor。必须是以下类型之一:int32,int64。ref第一维的索引张量。 -
updates一个Tensor。必须与ref具有相同的类型。要存储在ref中的更新值的张量。 -
use_locking可选的bool。默认为True。如果为 True,则分配将受锁保护;否则行为是未定义的,但可能表现出较少的争用。 -
name操作的名称(可选)。
返回
-
与
ref相同。返回以方便在更新完成后想要使用更新值的操作。
该操作计算
# Scalar indices
ref[indices, ...] = updates[...]
# Vector indices (for each i)
ref[indices[i], ...] = updates[i, ...]
# High rank indices (for each i, ..., j)
ref[indices[i, ..., j], ...] = updates[i, ..., j, ...]
此操作在更新完成后输出ref。这使得链接需要使用重置值的操作更容易。
如果 ref 中的值要更新一次以上,因为 indices 中有重复的条目,则每个值的更新顺序是未定义的。
需要 updates.shape = indices.shape + ref.shape[1:] 。
相关用法
- Python tf.compat.v1.scatter_min用法及代码示例
- Python tf.compat.v1.scatter_add用法及代码示例
- Python tf.compat.v1.scatter_div用法及代码示例
- Python tf.compat.v1.scatter_nd_sub用法及代码示例
- Python tf.compat.v1.scatter_mul用法及代码示例
- Python tf.compat.v1.scatter_sub用法及代码示例
- Python tf.compat.v1.scatter_nd_update用法及代码示例
- Python tf.compat.v1.scatter_nd_add用法及代码示例
- Python tf.compat.v1.scatter_max用法及代码示例
- Python tf.compat.v1.scalar_mul用法及代码示例
- Python tf.compat.v1.scan用法及代码示例
- Python tf.compat.v1.strings.length用法及代码示例
- Python tf.compat.v1.summary.merge用法及代码示例
- Python tf.compat.v1.size用法及代码示例
- Python tf.compat.v1.summary.FileWriter用法及代码示例
- Python tf.compat.v1.space_to_batch用法及代码示例
- Python tf.compat.v1.string_split用法及代码示例
- Python tf.compat.v1.squeeze用法及代码示例
- Python tf.compat.v1.set_random_seed用法及代码示例
- Python tf.compat.v1.sparse_to_dense用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.compat.v1.scatter_update。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
