class_docstr: Base class for data generators.
docstr: Base initializer for data generators.
  
  :param size: Total size of the dataset.
  :param batch_size: Size of the minibatches.
code: def __init__(self, size: Optional[int], batch_size: int) -> None:
      """
      Base initializer for data generators.
  
      :param size: Total size of the dataset.
      :param batch_size: Size of the minibatches.
      """
      if size is not None and (not isinstance(size, int) or size < 1):
          raise ValueError(
              "The total size of the dataset must be an integer greater than zero."
          )
      self._size = size
  
      if not isinstance(batch_size, int) or batch_size < 1:
          raise ValueError(
              "The batch size must be an integer greater than zero."
          )
      self._batch_size = batch_size
  
      if size is not None and batch_size > size:
          raise ValueError(
              "The batch size must be smaller than the dataset size."
          )
  
      self._iterator: Optional[Any] = None
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import abc
  import inspect
  import logging
  from typing import Any, Dict, Generator, Iterator, Optional, Tuple, Union, TYPE_CHECKING
  import numpy
label_desc: Use image node_id 1 to create a new DataGenerator object from inherited base classes: abc with example: obj = DataGenerator(size, batch_size)