全国人大代表陈飘向基层干部宣讲全国两会精神

paddle.distributed. all_gather_object ( object_list: list[_T], obj: _T, group: Group = None ) None [source]
百度 而另一位联名作者丹尼尔·夏皮罗(DanielShapiro),则是哈佛大学谈判组副主任,之前在麻省理工学院斯隆管理学院任教,为企业高管和外交官传授谈判技巧。

Gather picklable objects from all participators and all get the result. Similar to all_gather(), but python object can be passed in.

Parameters
  • object_list (list) – A list of output object. The datatype of every element in the list is same as the input obj.

  • obj (Any) – The picklable object to send.

  • group (Group) – The group instance return by new_group or None for global default group.

Returns

None.

Warning

This API only supports the dygraph mode.

Examples

>>> 
>>> import paddle
>>> import paddle.distributed as dist

>>> dist.init_parallel_env()
>>> object_list = [] # type: ignore
>>> if dist.get_rank() == 0:
...     obj = {"foo": [1, 2, 3]}
>>> else:
...     obj = {"bar": [4, 5, 6]}
>>> dist.all_gather_object(object_list, obj)
>>> print(object_list)
>>> # [{'foo': [1, 2, 3]}, {'bar': [4, 5, 6]}] (2 GPUs)