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

33 lines
1.1 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.Broadcast
========================
.. py:class:: mindspore.ops.Broadcast(root_rank, group=GlobalComm.WORLD_COMM_GROUP)
对输入数据整组广播。
.. note::
集合中的所有进程的Tensor的shape和数据格式相同。
参数:
- **root_rank** (int) - 表示发送源的进程编号。只有该进程会广播张量。
- **group** (str可选) - 表示通信域。默认值: ``GlobalComm.WORLD_COMM_GROUP``
输入:
- **input_x** (tuple[Tensor]) - Tensor的shape为 :math:`(x_1, x_2, ..., x_R)`
输出:
tuple[Tensor]Tensor的shape与输入相同:math:`(x_1, x_2, ..., x_R)` 。内容取决于 `root_rank` device的数据。
异常:
- **TypeError** - root_rank不是int或group不是str。
样例:
.. note::
.. include:: mindspore.ops.comm_note.rst
该样例需要在多卡环境下运行。
教程样例:
- `分布式集合通信原语 - Broadcast
<https://www.mindspore.cn/docs/zh-CN/master/api_python/samples/ops/communicate_ops.html#broadcast>`_