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

123456789101112131415161718192021222324252627
  1. mindspore.ops.AllReduce
  2. ========================
  3. .. py:class:: mindspore.ops.AllReduce(op=ReduceOp.SUM, group=GlobalComm.WORLD_COMM_GROUP)
  4. 使用指定方式对通信组内的所有设备的Tensor数据进行规约操作,所有设备都得到相同的结果
  5. .. note::
  6. AllReduce操作暂不支持"prod"。集合中的所有进程的Tensor必须具有相同的shape和格式。用户在使用之前需要设置环境变量,运行下面的例子。获取详情请点击官方网站 `MindSpore <https://www.mindspore.cn/docs/api/zh-CN/master/api_python/mindspore.ops.html#communication-operators>`_ 。
  7. **参数:**
  8. - **op** (str) - 规约的具体操作,如"sum"、"max"、和"min"。默认值:ReduceOp.SUM。
  9. - **group** (str) - 工作的通信组。默认值:"GlobalComm.WORLD_COMM_GROUP"(即Ascend平台为"hccl_world_group",GPU平台为"nccl_world_group" )。
  10. **输入:**
  11. - **input_x** (Tensor) - shape为 :math:`(x_1, x_2, ..., x_R)` 的Tensor。
  12. **输出:**
  13. Tensor,shape与输入相同,即 :math:`(x_1, x_2, ..., x_R)` 。其内容取决于操作。
  14. **异常:**
  15. - **TypeError** - `op` 或 `group` 不是str,或者输入的数据类型是bool。
  16. - **ValueError** - `op` 为"prod"。