gigl.common.collections.batch#
- gigl.common.collections.itertools.batch(list_of_items: List[T], chunk_size: int) List[List[T]] #
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]]
- Args:
list_of_items (List[T]): The list of items to be batched chunk_size (int): The desired size of each batch
- Returns:
List[List[T]]: A list of batches of items