Skip to content

Commit

Permalink
Fixed issue where the estimator was printing beyond the dataset size … (
Browse files Browse the repository at this point in the history
apache#14464)

* Fixed issue where the estimator was printing beyond the dataset size for the last batch

* Added comments

* Nudge to CI
  • Loading branch information
piyushghai authored and nswamy committed Apr 5, 2019
1 parent f250e1e commit 7f06bfa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/mxnet/gluon/estimator/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,11 @@ def fit(self, train_data,
self.train_stats['batch_' + loss_metric.name] = loss_metric.get()[1]

try:
self.train_stats['step'] = "{}/{}".format(batch_size * (i + 1), len(train_data._dataset))
completed_samples = len(train_data._dataset) if i == len(train_data._dataset) - 1 \
else batch_size * (i + 1)
# We need to check if this is the last batch in the current epoch and select
# the value to print appropriately
self.train_stats['step'] = "{}/{}".format(completed_samples, len(train_data._dataset))
except AttributeError:
self.train_stats['step'] = i

Expand Down

0 comments on commit 7f06bfa

Please sign in to comment.