当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python tf.raw_ops.ResourceScatterDiv用法及代码示例


将稀疏更新划分为 resource 引用的变量。

用法

tf.raw_ops.ResourceScatterDiv(
    resource, indices, updates, name=None
)

参数

  • resource Tensor 类型为 resource 。应该来自 Variable 节点。
  • indices 一个Tensor。必须是以下类型之一:int32 , int64ref 第一维的索引张量。
  • updates 一个Tensor。必须是以下类型之一:float32 , float64 , int32 , uint8 , int16 , int8 , complex64 , int64 , qint8 , quint8 , qint32 , bfloat16 , uint16 , complex128 , half , uint32 , uint64。要添加到 ref 的更新值的张量。
  • name 操作的名称(可选)。

返回

  • 创建的操作。

该操作计算

# 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, ...]

正确处理重复条目:如果多个 indices 引用相同的位置,它们的贡献会成倍增加。

需要 updates.shape = indices.shape + ref.shape[1:]updates.shape = []

相关用法


注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.raw_ops.ResourceScatterDiv。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。