Skip to content

Commit

Permalink
improve docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
jarandaf committed Mar 23, 2022
1 parent 12eb822 commit aae2993
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion petastorm/pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ def decimal_friendly_collate(batch):


class BackgroundIterator(threading.Thread):
"""Prefetch iterator results."""
"""Prefetch iterator results. A thread iterates the original iterator and
populates a queue. Iterating over this background iterator just consumes the underlying
queue until no other result is available."""
def __init__(self, iterator, prefetch=1000):
threading.Thread.__init__(self)
self.queue = Queue(prefetch)
Expand Down

0 comments on commit aae2993

Please sign in to comment.