未验证 提交 df00636b 编写于 作者: L lilong12 提交者: GitHub

update, test=develop (#32731)

上级 035c7425
...@@ -44,7 +44,6 @@ std::map<std::string, std::set<std::string>> op_ins_map = { ...@@ -44,7 +44,6 @@ std::map<std::string, std::set<std::string>> op_ins_map = {
{"gru_unit", {"Input", "HiddenPrev", "Weight", "Bias"}}, {"gru_unit", {"Input", "HiddenPrev", "Weight", "Bias"}},
{"label_smooth", {"X", "PriorDist"}}, {"label_smooth", {"X", "PriorDist"}},
{"assign", {"X"}}, {"assign", {"X"}},
{"send_v2", {"X"}},
{"reshape2", {"X", "Shape"}}, {"reshape2", {"X", "Shape"}},
{"expand", {"X", "ExpandTimes"}}, {"expand", {"X", "ExpandTimes"}},
{"slice", {"Input", "StartsTensor", "EndsTensor"}}, {"slice", {"Input", "StartsTensor", "EndsTensor"}},
......
...@@ -1186,23 +1186,24 @@ def send(tensor, dst=0, group=None, use_calc_stream=True): ...@@ -1186,23 +1186,24 @@ def send(tensor, dst=0, group=None, use_calc_stream=True):
tensor (Tensor): The Tensor to send. Its data type tensor (Tensor): The Tensor to send. Its data type
should be float16, float32, float64, int32 or int64. should be float16, float32, float64, int32 or int64.
dst (int): The destination rank id. dst (int): The destination rank id.
group (Group): The group instance return by new_group or None for global default group. group (Group, optional): The group instance return by new_group or None for global default group. Default: None.
use_calc_stream (bool): Whether to use calculate stream or communication stream. use_calc_stream (bool, optional): Whether to use calculate stream or communication stream. Default: True.
Returns: Returns:
None. None.
Examples: Examples:
.. code-block:: python .. code-block:: python
# required: distributed
import paddle import paddle
#from paddle.distributed import init_parallel_env from paddle.distributed import init_parallel_env
#init_parallel_env() init_parallel_env()
#if paddle.distributed.ParallelEnv().rank == 0: if paddle.distributed.ParallelEnv().rank == 0:
# data = paddle.to_tensor([7, 8, 9]) data = paddle.to_tensor([7, 8, 9])
# paddle.distributed.send(data, dst=1) paddle.distributed.send(data, dst=1)
#else: else:
# data = paddle.to_tensor([1,2,3]) data = paddle.to_tensor([1,2,3])
# paddle.distributed.recv(data, src=0) paddle.distributed.recv(data, src=0)
#out = data.numpy() out = data.numpy()
""" """
if group is not None and not group.is_member(): if group is not None and not group.is_member():
return return
...@@ -1235,23 +1236,24 @@ def recv(tensor, src=0, group=None, use_calc_stream=True): ...@@ -1235,23 +1236,24 @@ def recv(tensor, src=0, group=None, use_calc_stream=True):
tensor (Tensor): The Tensor to receive. Its data type tensor (Tensor): The Tensor to receive. Its data type
should be float16, float32, float64, int32 or int64. should be float16, float32, float64, int32 or int64.
src (int): The source rank id. src (int): The source rank id.
group (Group): The group instance return by new_group or None for global default group. group (Group, optional): The group instance return by new_group or None for global default group. Default: None.
use_calc_stream (bool): Whether to use calculate stream or communication stream. use_calc_stream (bool, optional): Whether to use calculate stream or communication stream. Default: True.
Returns: Returns:
None. None.
Examples: Examples:
.. code-block:: python .. code-block:: python
# required: distributed
import paddle import paddle
#from paddle.distributed import init_parallel_env from paddle.distributed import init_parallel_env
#init_parallel_env() init_parallel_env()
#if paddle.distributed.ParallelEnv().rank == 0: if paddle.distributed.ParallelEnv().rank == 0:
# data = paddle.to_tensor([7, 8, 9]) data = paddle.to_tensor([7, 8, 9])
# paddle.distributed.send(data, dst=1) paddle.distributed.send(data, dst=1)
#else: else:
# data = paddle.to_tensor([1,2,3]) data = paddle.to_tensor([1,2,3])
# paddle.distributed.recv(data, src=0) paddle.distributed.recv(data, src=0)
#out = data.numpy() out = data.numpy()
""" """
if group is not None and not group.is_member(): if group is not None and not group.is_member():
return return
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册