class_docstr: An abstract ``DataIterator`` class. ``DataIterators`` must override ``_create_batches()``.
  
  Parameters
  ----------
  batch_size : ``int``, optional, (default = 32)
      The size of each batch of instances yielded when calling the iterator.
  instances_per_epoch : ``int``, optional, (default = None)
      If specified, each epoch will consist of precisely this many instances.
      If not specified, each epoch will consist of a single pass through the dataset.
  max_instances_in_memory : ``int``, optional, (default = None)
      If specified, the iterator will load this many instances at a time into an
      in-memory list and then produce batches from one such list at a time. This
      could be useful if your instances are read lazily from disk.
  cache_instances : ``bool``, optional, (default = False)
      If true, the iterator will cache the tensorized instances in memory.
      If false, it will do the tensorization anew each iteration.
  track_epoch : ``bool``, optional, (default = False)
      If true, each instance will get a ``MetadataField`` containing the epoch number.
  maximum_samples_per_batch : ``Tuple[str, int]``, (default = None)
      If specified, then is a tuple (padding_key, limit) and we will
      shrink the batch size for very long sequences such that
      batch_size * sequence_length <= limit where sequence_length is given
      by the padding_key.
code: def __init__(
      self,
      batch_size=32,
      instances_per_epoch=None,
      max_instances_in_memory=None,
      cache_instances=False,
      track_epoch=False,
      maximum_samples_per_batch=None,
  ):
      self.vocab = None
  
      self._batch_size = batch_size
      self._max_instances_in_memory = max_instances_in_memory
      self._instances_per_epoch = instances_per_epoch
      self._maximum_samples_per_batch = maximum_samples_per_batch
  
      # We might want to cache the instances in memory.
      self._cache_instances = cache_instances
      self._cache = defaultdict(list)
  
      # We also might want to add the epoch number to each instance.
      self._track_epoch = track_epoch
      self._epochs = defaultdict(int)
  
      # We also might want to keep track of cursors;
      # for example, if each epoch represents less than one pass through the dataset,
      # we want to remember where we left off. As `Iterator`s are not necessarily hashable,
      # we use their id() as the key.
      self._cursors = {}
  
imports: from __future__ import division
  from __future__ import absolute_import
  import logging
  from collections import defaultdict
  import itertools
  import math
  import random
  import torch
  from allennlp.common.registrable import Registrable
  from allennlp.common.util import is_lazy, lazy_groups_of, ensure_list
  from allennlp.data.dataset import Batch
  from allennlp.data.fields import MetadataField
  from allennlp.data.instance import Instance
  from allennlp.data.vocabulary import Vocabulary
label_desc: Use image node_id 1 to create a new DataIterator object from inherited base classes: Registrable with example: obj = DataIterator(batch_size, instances_per_epoch, max_instances_in_memory, cache_instances, track_epoch, maximum_samples_per_batch)