spdl.source.utils.repeat_source¶
- repeat_source(src: Iterable[T] | IterableWithShuffle[T], epoch: int = 0) Iterator[T] [source]¶
Convert an iterable into an infinite iterator with optional shuffling.
Roughly equivalent to the following code snippet.
while True: if hasattr(src, "shuffle"): src.shuffle(seed=epoch) yield from src epoch += 1
- Parameters:
src – The source to repeat.
epoch – The epoch number to start with.