class_docstr: A very simple `DataLoader` that is mostly used for testing.
code: def __iter__(self) -> Iterator[TensorDict]:
      if self.batches_per_epoch is None:
          yield from self._iter_batches()
      else:
          if self._batch_generator is None:
              self._batch_generator = self._iter_batches()
          for i in range(self.batches_per_epoch):
              try:
                  yield next(self._batch_generator)
              except StopIteration:  # data_generator is exhausted
                  self._batch_generator = (
                      self._iter_batches()
                  )  # so refresh it
                  yield next(self._batch_generator)
  
imports: import math
  import random
  from typing import Optional, List, Iterator
  import torch
  from allennlp.common.util import lazy_groups_of
  from allennlp.common.tqdm import Tqdm
  from allennlp.data.data_loaders.data_loader import DataLoader, TensorDict
  from allennlp.data.data_loaders.data_collator import DefaultDataCollator
  from allennlp.data.dataset_readers import DatasetReader
  from allennlp.data.instance import Instance
  from allennlp.data.vocabulary import Vocabulary
  import allennlp.nn.util
label_desc: Use image node_id 3 for calling the SimpleDataLoader obj's underlying member method code with example usage: obj.__iter__() without return types