You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.ops.ScatterAdd.rst 1.5 kB

123456789101112131415161718192021222324252627282930313233343536
  1. mindspore.ops.ScatterAdd
  2. =========================
  3. .. py:class:: mindspore.ops.ScatterAdd(use_locking=False)
  4. 根据指定更新值和输入索引通过加法运算更新输入数据的值。
  5. 对于 `indices.shape` 的每个 `i, ..., j` :
  6. .. math::
  7. \text{input_x}[\text{indices}[i, ..., j], :] \mathrel{+}= \text{updates}[i, ..., j, :]
  8. 输入的 `input_x` 和 `updates` 遵循隐式类型转换规则,以确保数据类型一致。如果数据类型不同,则低精度数据类型将转换为高精度的数据类型。当参数的数据类型需要转换时,则会抛出RuntimeError异常。
  9. .. note::
  10. 这是一个运行即更新的算子。因此, `input_x` 在运算完成后即更新。
  11. **参数:**
  12. - **use_locking** (bool) - 是否启用锁保护。默认值:False。
  13. **输入:**
  14. - **input_x** (Parameter) - ScatterAdd的输入,任意维度的Parameter。
  15. - **indices** (Tensor) - 指定相加操作的索引,数据类型为mindspore.int32。
  16. - **updates** (Tensor) - 指定与 `input_x` 相加操作的Tensor,数据类型与 `input_x` 相同,shape为 `indices_shape + x_shape[1:]` 。
  17. **输出:**
  18. Tensor,更新后的 `input_x` ,shape和数据类型与`input_x`相同。
  19. **异常:**
  20. - **TypeError** - `use_locking` 不是bool。
  21. - **TypeError** - `indices` 不是int32。
  22. - **ValueError ** - `updates` 的shape不等于 `indices_shape + x_shape[1:]` 。