recpack.algorithms.util.get_batches

recpack.algorithms.util.get_batches(iterable: Iterable, batch_size=1000) Iterator[List]

Get batches from an iterable.

The final batch might contain less than batch_size entries, as it will be the remainder.

Parameters
  • iterable (Iterable) – List of values that will be split into batches of size batch_size

  • batch_size (int, optional) – Size of each batch, defaults to 1000

Yield

Iterator of lists of values

Return type

Iterator[List]