class_docstr: DataLoader wrapper with slightly improved speed by not respawning worker
  processes at every epoch.
class_docstr_tok: ["DataLoader","wrapper","with","slightly","improved","speed","by","not","respawning","worker","processes","at","every","epoch","."]
code: def __init__(self, dataset, batch_size, num_workers):
      super().__init__()
  
      batch_sampler = torch.utils.data.BatchSampler(
          torch.utils.data.RandomSampler(dataset, replacement=False),
          batch_size=batch_size,
          drop_last=False,
      )
  
      self._infinite_iterator = iter(
          torch.utils.data.DataLoader(
              dataset,
              num_workers=num_workers,
              batch_sampler=_InfiniteSampler(batch_sampler),
          )
      )
  
      self._length = len(batch_sampler)
  
file_path: dowhy/dowhy/causal_prediction/dataloaders/fast_data_loader.py
imports: import torch
label_desc: Use image node_id 1 to create a new FastDataLoader object  with example: obj = FastDataLoader(dataset, batch_size, num_workers)