class_docstr: Handles iterating over epoch-level `tp.Iterator` objects.
class_docstr_tok: ["Handles","iterating","over","epoch-level","`","tp.Iterator","`","objects","."]
docstr: Yields `(epoch, tp.Iterator)`.
docstr_tok: ["Yields","`","(","epoch",",","tp.Iterator",")","`","."]
code: def enumerate_epochs(self):
      """Yields `(epoch, tp.Iterator)`."""
      data_iterator = self._dataset()
      for epoch in range(self._initial_epoch, self._epochs):
          if self._insufficient_data:  # Set by `catch_stop_iteration`.
              break
          if self._adapter.should_recreate_iterator():
              data_iterator = self._dataset()
          yield epoch, data_iterator
          self._adapter.on_epoch_end()
  
file_path: elegy/elegy/data/data_handler.py
imports: import contextlib
  import logging
  from .array_adapter import ArrayDataAdapter
  from .dataset import DataLoaderAdapter
  from .generator_adapter import GeneratorDataAdapter
  from .list_adapter import ListsOfScalarsDataAdapter
label_desc: Use image node_id 2 for calling the DataHandler obj's underlying member method code with example usage: obj.enumerate_epochs() without return types