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.
docstr: This method should return one epoch worth of batches.
docstr_tok: ["This","method","should","return","one","epoch","worth","of","batches","."]
code: def _create_batches(self, instances, shuffle):
      """
      This method should return one epoch worth of batches.
      """
      raise NotImplementedError
  
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 7 for calling the DataIterator obj's underlying member method code with example usage: obj._create_batches(instances, shuffle) without return types