batch#
- gym_socks.utils.batch.generate_batches(num_elements, batch_size)[source]#
Generate batches.
Batch generation function to split a list into smaller batches (slices). Generates slice objects, which can be iterated over in a for loop.
- Parameters
num_elements – Length of the list.
batch_size – Maximum size of the batches. If the last batch is smaller than batch_size, then the final batch will be the length of the remaining elements.
- Yields
A slice object.