consec-model-weights / src /utils /collections.py
Harsha909's picture
Upload 47 files
6dc7c27 verified
Raw
History Blame Contribute Delete
263 Bytes
from typing import List
def flatten(lst: List[list]) -> list:
return [_e for sub_l in lst for _e in sub_l]
def chunks(lst, n):
"""Yield successive n-sized chunks from lst."""
for i in range(0, len(lst), n):
yield lst[i : i + n]