TensorDictBase.irecv#
- TensorDictBase.irecv(src: int | None = None, *, group: 'torch.distributed.ProcessGroup' | None = None, group_src: int | None = None, return_premature: bool = False, init_tag: int = 0, pseudo_rand: bool = False, consolidated: bool = False) tuple[int, list[torch.Future]] | list[torch.Future] | None#
Receives the content of a tensordict and updates content with it asynchronously.
Check the example in the
isend()method for context.- Parameters:
src (int, optional) – the global rank of the source worker. Mutually exclusive with
group_src; exactly one of the two must be provided.- Keyword Arguments:
group (torch.distributed.ProcessGroup, optional) – if set, the specified process group will be used for communication. Otherwise, the default process group will be used. Defaults to
None.group_src (int, optional) – the rank of the source worker relative to
group. Requiresgroupto be passed and is mutually exclusive withsrc. When set, the p2p calls are issued directly on the group’s backend, sogroupmay be a standaloneProcessGroupbuilt against a store (never registered throughinit_process_group()ornew_group()). Defaults toNone.return_premature (bool) – if
True, returns a list of futures to wait upon until the tensordict is updated. Defaults toFalse, i.e. waits until update is completed withing the call.init_tag (int) – the
init_tagused by the source worker.pseudo_rand (bool) – if True, the sequence of tags will be pseudo- random, allowing to send multiple data from different nodes without overlap. Notice that the generation of these pseudo-random numbers is expensive (1e-5 sec/number), meaning that it could slow down the runtime of your algorithm. This value must match the one passed to
isend(). Defaults toFalse.consolidated (bool) – if True, receives a single consolidated storage tensor directly into
self._consolidated["storage"], asrecv()does. The tensordict must already be consolidated (e.g. from a priorfrom_remote_init()call), and all leaf tensor views update in-place. Withreturn_premature=True, the returned list holds the single future.init_tagandpseudo_randare ignored. Defaults toFalse.
- Returns:
- if
return_premature=True, a list of futures to wait upon until the tensordict is updated.
- if
Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.