mindspore/docs/api/api_python/ops/mindspore.ops.AlltoAll.rst

42 lines
1.9 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.AlltoAll
======================
.. py:class:: mindspore.ops.AlltoAll(split_count, split_dim, concat_dim, group=GlobalComm.WORLD_COMM_GROUP)
AlltoAll是一个集合通信函数。
AlltoAll将输入数据在特定的维度切分成特定的块数blocks并按顺序发送给其他rank。一般有两个阶段
- 分发阶段:在每个进程上,操作数沿着 `split_dim` 拆分为 `split_count` 个块blocks且分发到指定的rank上例如第i块被发送到第i个rank上。
- 聚合阶段每个rank沿着 `concat_dimension` 拼接接收到的数据。
.. note::
聚合阶段所有进程中的Tensor必须具有相同的shape和格式。
要求全连接配网方式每台设备具有相同的vlan idip和mask在同一子网请查看 `详细信息 <https://www.mindspore.cn/tutorials/experts/zh-CN/master/parallel/communicate_ops.html#注意事项>`_
参数:
- **split_count** (int) - 在每个进程上将块blocks拆分为 `split_count` 个。
- **split_dim** (int) - 在每个进程上,沿着 `split_dim` 维度进行拆分。
- **concat_dim** (int) - 在每个进程上,沿着 `concat_dimension` 拼接接收到的块blocks
- **group** (str) - AlltoAll的通信域。默认值"GlobalComm.WORLD_COMM_GROUP"。
输入:
- **input_x** (Tensor) - shape为 :math:`(x_1, x_2, ..., x_R)`
输出:
Tensor设输入的shape是 :math:`(x_1, x_2, ..., x_R)`则输出的shape为 :math:`(y_1, y_2, ..., y_R)`,其中:
- :math:`y_{split\_dim} = x_{split\_dim} / split\_count`
- :math:`y_{concat\_dim} = x_{concat\_dim} * split\_count`
- :math:`y_{other} = x_{other}`.
异常:
- **TypeError** - 如果 `group` 不是字符串。
样例:
.. note::
.. include:: mindspore.ops.comm_note.rst
该样例需要在8卡环境下运行。