raffalib.itertools

Functions

batch_boundaries(total, n_per_batch)

Yield (batchi, start_ix, end_ix) for batches of size n_per_batch.

Module Contents

raffalib.itertools.batch_boundaries(total, n_per_batch)

Yield (batchi, start_ix, end_ix) for batches of size n_per_batch. Example: list(batch_boundaries(20, 3)) [(0, 1, 3), (1, 4, 6), (2, 7, 9), (3, 10, 12), (4, 13, 15), (5, 16, 18), (6, 19, 20)]