batch#
- gym_socks.utils.batch.batch_generator(s, size)[source]#
Generate batches.
Batch generation function to split a sequence into smaller batches (slices). Generates slice objects, which can be iterated over in a for loop.
- Parameters
s (collections.abc.Sequence) – A sequence.
size (int) – Size of the batches. If the last batch is smaller than size, then the final batch will be the length of the remaining elements.
- Yields
A slice object.