class_docstr: A `TfmdDL` which splits a batch into equal size pieces for each worker
class_docstr_tok: ["A","`","TfmdDL","`","which","splits","a","batch","into","equal","size","pieces","for","each","worker"]
code: def get_idxs(self):
      idxs = list(
          self.dl.get_idxs()
      )  # compute get_idxs in all ranks (we'll only use rank 0 but size must be consistent)
      idxs = self._broadcast(
          idxs, 0
      )  # broadcast and receive it from rank 0 to all
      self.n = len(
          idxs
      )  # we assumed n was dl.n but we really care about number of idxs
      # add extra samples to make it evenly divisible
      self.n_padded = _round_to_multiple(self.n, self.world_size)
      idxs += (idxs * (self.n_padded // self.n))[
          : self.n_padded - self.n
      ]  # idx needs to be repeated when n_padded>>n
      # slice padded idxs so that each rank gets self.n_padded//self.world_size tensors
      return idxs[
          self.rank
          * self.n_padded
          // self.world_size : (self.rank + 1)
          * self.n_padded
          // self.world_size
      ]
  
imports: from __future__ import annotations
  from .basics import *
  from .callback.progress import ProgressCallback
  from torch.nn.parallel import DistributedDataParallel, DataParallel
  from .data.load import _FakeLoader, _loaders
  from .optimizer import OptimWrapper
label_desc: Use image node_id 5 for calling the DistributedDL obj's underlying member method code with example usage: obj.get_idxs() and returns: idxs