pyconstruct.utils.batches

pyconstruct.utils.batches(*args, n_batches=None, batch_size=None)

Returns a generator of batches.

Takes an arbitrary number of array-like objects and splits them into batches. One can either require a certain number of batches or a certain batch size.

Parameters:
  • *args – A list of numpy.ndarrays as input parameters.
  • n_batches (int) – The number of batches to split the data into.
  • batch_size (int) – The size of the batches to split the data into.
Returns:

A generator of batches.

Return type:

generator