diff --git a/python/mxnet/gluon/estimator/estimator.py b/python/mxnet/gluon/estimator/estimator.py index 159f7e220427..c160115ac807 100644 --- a/python/mxnet/gluon/estimator/estimator.py +++ b/python/mxnet/gluon/estimator/estimator.py @@ -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