mindspore/docs/api/api_python/ops/mindspore.ops.ReduceScatter...

31 lines
1.3 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.ReduceScatter
===========================
.. py:class:: mindspore.ops.ReduceScatter(op=ReduceOp.SUM, group=GlobalComm.WORLD_COMM_GROUP)
规约并且分发指定通信组中的张量。更多细节请参考 `分布式集合通信原语 - ReduceScatter <https://www.mindspore.cn/tutorials/experts/zh-CN/master/parallel/communicate_ops.html#reducescatter>`_
.. note::
在集合的所有过程中Tensor必须具有相同的shape和格式。
参数:
- **op** (str) - 指定用于元素的规约操作如SUM和MAX。默认值ReduceOp.SUM。
- **group** (str) - 要处理的通信组。默认值:"GlobalComm.WORLD_COMM_group"。
输入:
- **input_x** (Tensor) - 输入Tensor假设其形状为 :math:`(N, *)` ,其中 `*` 为任意数量的额外维度。N必须能够被rank_size整除rank_size为当前通讯组里面的计算卡数量。
输出:
Tensor数据类型与 `input_x` 一致shape为 :math:`(N/rank\_size, *)`
异常:
- **TypeError** - 如果 `op``group` 不是字符串。
- **ValueError** - 如果输入的第一个维度不能被rank size整除。
样例:
.. note::
.. include:: mindspore.ops.comm_note.rst
该样例需要在2卡环境下运行。