neuraltrain.utils.TimedIterator

class neuraltrain.utils.TimedIterator(iterable: Iterable[X], store_last: int = 100)[source][source]

Keeps last fetch durations of the iterator, as well as last call to call durations. This is handy to investigate ratio spent in a dataloader compared to the whole training loop.

Parameters:
  • iterable (iterable) – The iterable to analyze, ususally a torch Dataloader

  • store_last (int) – maximum number of durations to keep in memory

Note

estimated_ratio is based on mean values, you may want check - last_calls: last durations of the iterable call - last_loops: last durations of the full loop back to the iterable