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.ScatterUpdate.rst 1.3 kB

1234567891011121314151617181920212223242526272829303132
  1. mindspore.ops.ScatterUpdate
  2. ============================
  3. .. py:class:: mindspore.ops.ScatterUpdate(use_locking=True)
  4. 使用给定的更新值和输入索引更新数据的值。
  5. 对于每个在 `indices.shape` 中的 `i, ..., j` :
  6. .. math::
  7. \text{input_x}[\text{indices}[i, ..., j], :]= \text{updates}[i, ..., j, :]
  8. 输入的 `input_x` 和 `updates` 遵循隐式类型转换规则,以确保数据类型一致。如果它们具有不同的数据类型,则低精度数据类型将转换为高精度数据类型。当需要转换Parameter的数据类型时,会抛出RuntimeError异常。
  9. **参数:**
  10. - **use_locking** (bool) - 表示是否使用锁来保护。默认值:True。
  11. **输入:**
  12. - **input_x** (Parameter) - ScatterUpdate的输入,任意维度的Parameter。
  13. - **indices** (Tensor) - 指定更新操作的索引。数据类型为int32。如果索引中存在重复项,则更新的顺序无法得知。
  14. - **updates** (Tensor) - 指定与 `input_x` 更新操作的Tensor,其数据类型与 `input_x` 相同,shape为 `indices.shape + input_x.shape[1:]` 。
  15. **输出:**
  16. Tensor,shape和数据类型与输入 `input_x` 相同。
  17. **异常:**
  18. - **TypeError** - `use_locking` 不是bool。
  19. - **TypeError** - `indices` 不是int32。