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 __init__(self, dl, rank=None, world_size=None, device=None):
      if rank is None:
          rank = rank_distrib()
      if world_size is None:
          world_size = num_distrib()
      store_attr()
      if type(dl) == torch.utils.data.DataLoader:
          shuffle = (
              True
              if eq(type(dl.sampler), torch.utils.data.RandomSampler)
              else False
          )
          self.dl = DataLoader(
              dataset=dl.dataset,
              bs=dl.batch_size,
              num_workers=dl.num_workers,
              pin_memory=dl.pin_memory,
              timeout=dl.timeout,
              shuffle=shuffle,
              drop_last=dl.drop_last,
              persistent_workers=dl.persistent_workers,
          )
      (
          self.bs,
          self.drop_last,
          self.dataset,
          fake,
          self.num_workers,
          self.offs,
          self.pin_memory,
      ) = attrgetter(
          "bs",
          "drop_last",
          "dataset",
          "fake_l",
          "num_workers",
          "offs",
          "pin_memory",
      )(
          self.dl
      )
      if device is None:
          self.device = self.dl.device
      self.fake_l = _FakeLoader(
          self,
          fake.pin_memory,
          fake.num_workers,
          fake.timeout,
          persistent_workers=fake.persistent_workers,
          pin_memory_device=fake.pin_memory_device,
      )
  
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 1 to create a new DistributedDL object from inherited base classes: TfmdDL with example: obj = DistributedDL(dl, rank, world_size, device)