Rate this Page
★ ★ ★ ★ ★

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. Requires group to be passed and is mutually exclusive with src. When set, the p2p calls are issued directly on the group’s backend, so group may be a standalone ProcessGroup built against a store (never registered through init_process_group() or new_group()). Defaults to None.

  • return_premature (bool) – if True, returns a list of futures to wait upon until the tensordict is updated. Defaults to False, i.e. waits until update is completed withing the call.

  • init_tag (int) – the init_tag used 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 to False.

  • consolidated (bool) – if True, receives a single consolidated storage tensor directly into self._consolidated["storage"], as recv() does. The tensordict must already be consolidated (e.g. from a prior from_remote_init() call), and all leaf tensor views update in-place. With return_premature=True, the returned list holds the single future. init_tag and pseudo_rand are ignored. Defaults to False.

Returns:

if return_premature=True, a list of futures to wait

upon until the tensordict is updated.

Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.