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 leaves that
isend()orsend()sends, one asynchronous transfer per leaf.The tensordict must have the keys, shapes and dtypes of the tensordict that the sender sends; the values are written into its tensors in place. By default, the call waits until all the transfers are done. With
return_premature=True, it returns at once: callwait()on each returnedWorkobject before you read the tensordict. Seeisend()for an example, and Distributed tensordicts.- Parameters:
src (int, optional) – the global rank of the sender. Exclusive with
group_src: pass exactly one of them. Defaults toNone.- Keyword Arguments:
group (torch.distributed.ProcessGroup, optional) – the process group. Defaults to
None, the default process group.group_src (int, optional) – the rank of the sender in
group, which must be given. Exclusive withsrc. As inrecv(),groupcan then be a standalone process group. Defaults toNone.return_premature (bool, optional) – if
True, returns the list ofWorkobjects of the transfers without waiting for them. Defaults toFalse.init_tag (int, optional) – the
init_tagthat the sender passed. Defaults to0.pseudo_rand (bool, optional) – the
pseudo_randthat the sender passed. Defaults toFalse.consolidated (bool, optional) – if
True, receives one message into the consolidated storage of the tensordict, asrecv(consolidated=True)does. The tensordict must be consolidated already.init_tagandpseudo_randare ignored. Defaults toFalse.
- Returns:
With
return_premature=True, a list ofWorkobjects. Otherwise,None.- Raises:
ValueError – if both or none of
srcandgroup_srcare given, or ifgroup_srcis given withoutgroup.
Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.