In either case, it seems to me that Iterator type is not required, and an Iterable type will do. Python just treats the Iterator type as an Iterable. Hence, calling iter() seems unnecessary.
This is not a big issue by all means; I've been working on a project where instead of a DataLoader, I use a different iterable type, and the extra call to iter() in the KFAC implementation makes it a little bit annoying to ensure the tqdm progressbar receives a Sized object in the end.
In the following line,
self._data
is converted to anIterator
type before being either 1) passed totqdm
or 2) used in a for-loop.https://github.com/f-dangel/curvlinops/blob/8e47e5795487344830e591e7e6a568bc6e579c04/curvlinops/_base.py#L343
In either case, it seems to me that
Iterator
type is not required, and anIterable
type will do. Python just treats theIterator
type as anIterable
. Hence, callingiter()
seems unnecessary.This is not a big issue by all means; I've been working on a project where instead of a
DataLoader
, I use a different iterable type, and the extra call toiter()
in the KFAC implementation makes it a little bit annoying to ensure thetqdm
progressbar receives aSized
object in the end.