Skip to content

Commit

Permalink
Fix reporing of the end of epoch in MXNet and pyTorch plugins (#180)
Browse files Browse the repository at this point in the history
Signed-off-by: ptredak <ptredak@nvidia.com>
  • Loading branch information
ptrendx authored and JanuszL committed Sep 22, 2018
1 parent e811225 commit 49c1e43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dali/python/nvidia/dali/plugin/mxnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def __next__(self):
batch = self._first_batch
self._first_batch = None
return batch
if self._counter > self._size:
if self._counter >= self._size:
raise StopIteration
# Gather outputs
outputs = []
Expand Down Expand Up @@ -177,7 +177,7 @@ def reset(self):
DALI iterators do not support resetting before the end of the epoch
and will ignore such request.
"""
if self._counter > self._size:
if self._counter >= self._size:
self._counter = self._counter % self._size
else:
logging.warning("DALI iterator does not support resetting while epoch is not finished. Ignoring...")
Expand Down
4 changes: 2 additions & 2 deletions dali/python/nvidia/dali/plugin/pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __next__(self):
batch = self._first_batch
self._first_batch = None
return batch
if self._counter > self._size:
if self._counter >= self._size:
raise StopIteration
# Gather outputs
outputs = []
Expand Down Expand Up @@ -169,7 +169,7 @@ def reset(self):
DALI iterators do not support resetting before the end of the epoch
and will ignore such request.
"""
if self._counter > self._size:
if self._counter >= self._size:
self._counter = self._counter % self._size
else:
logging.warning("DALI iterator does not support resetting while epoch is not finished. Ignoring...")
Expand Down

0 comments on commit 49c1e43

Please sign in to comment.