gigl.common.collections.itertools#
Attributes#
Functions#
| 
 | Takes a list of items and batches them into provided chunk sizes. | 
Module Contents#
- gigl.common.collections.itertools.batch(list_of_items, chunk_size)[source]#
- Takes a list of items and batches them into provided chunk sizes. i.e. batch([1, 2, 3, 4, 5], 2) –> [[1, 2], [3, 4], [5]] - Parameters:
- list_of_items (list[T]) – The list of items to be batched 
- chunk_size (int) – The desired size of each batch 
 
- Returns:
- A list of batches of items 
- Return type:
- list[list[T]] 
 
