TensorDictBase.scatter#
- TensorDictBase.scatter(src: int, tensordicts: list | None = None, *, group: 'torch.distributed.ProcessGroup' | None = None, device: device | str | None = None) Self#
Scatters a list of tensordicts from
srcto all ranks.Every rank of the process group calls it, in an initialized
torch.distributedprocess group. On the source rank,tensordictsholds one tensordict per rank; each is consolidated (seeconsolidate()) and sent as one buffer. The other ranks rebuild their tensordict from the buffer they receive. The tensordict the method is called on is not used. See Distributed tensordicts.- Parameters:
src (int) – the rank of the source process.
tensordicts (list of TensorDictBase, optional) – on the source rank, the tensordicts to scatter, one per rank. Ignored on the other ranks. Defaults to
None.
- Keyword Arguments:
- Returns:
The tensordict that this rank receives.
Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.