-
Notifications
You must be signed in to change notification settings - Fork 440
Open
Description
What is the feature?
In mmegine.dataset.sampler.InfiniteSampler, would it better to change the function InifiniteSampler.iter to the following:
def __iter__(self) -> Iterator[int]:
"""Iterate the indices."""
# yield from self.indices
try:
for i in self.indices:
yield i
except StopIteration as e:
self.indices = self._indices_of_rank()
return self.__iter__()the original code is
def __iter__(self) -> Iterator[int]:
"""Iterate the indices."""
yield from self.indiceswhich may raise error when iter the dataloader more than once.
Any other context?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels