code: def minibatches(inputs, batch_size=None, shuffle=False):
      """
      Iterates batch slices.
  
      Parameters
      ----------
      inputs : array-like, list
  
      batch_size : int
          Mini-batch size. Number should be greater than ``0``.
  
      shuffle : bool
          Defaults to ``True``.
  
      Yields
      ------
      object
          Batch slices.
      """
      n_samples = count_samples(inputs)
      batch_size = n_samples if batch_size is None else batch_size
      n_batches = count_minibatches(inputs, batch_size)
  
      if shuffle:
          indices = np.arange(n_samples)
          np.random.shuffle(indices)
  
          for index in range(n_batches):
              batch_slice = slice(
                  index * batch_size, (index + 1) * batch_size
              )
              yield apply_slices(inputs, indices[batch_slice])
  
      elif n_batches != 1:
          for index in range(n_batches):
              batch_slice = slice(
                  index * batch_size, (index + 1) * batch_size
              )
              yield apply_slices(inputs, batch_slice)
  
      else:
          yield inputs
  
file_path: neupy/neupy/utils/iters.py
imports: from __future__ import division
  import math
  import numpy
  import progressbar
  from neupy.utils.misc import as_tuple
label_desc: Use image node_id 4 for calling a global function with example usage: minibatches(inputs, batch_size, shuffle) without return types