You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/07/18 18:56:37 UTC

[GitHub] szha closed pull request #11793: fix bug when prefetch_buffer=1

szha closed pull request #11793: fix bug when prefetch_buffer=1
URL: https://github.com/apache/incubator-mxnet/pull/11793
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/python/mxnet/module/base_module.py b/python/mxnet/module/base_module.py
index 4b7355ffa92..654e41bf365 100644
--- a/python/mxnet/module/base_module.py
+++ b/python/mxnet/module/base_module.py
@@ -514,12 +514,6 @@ def fit(self, train_data, eval_data=None, eval_metric='acc',
                     monitor.tic()
                 self.forward_backward(data_batch)
                 self.update()
-                try:
-                    # pre fetch next batch
-                    next_data_batch = next(data_iter)
-                    self.prepare(next_data_batch, sparse_row_id_fn=sparse_row_id_fn)
-                except StopIteration:
-                    end_of_batch = True
 
                 if isinstance(data_batch, list):
                     self.update_metric(eval_metric,
@@ -528,6 +522,13 @@ def fit(self, train_data, eval_data=None, eval_metric='acc',
                 else:
                     self.update_metric(eval_metric, data_batch.label)
 
+                try:
+                    # pre fetch next batch
+                    next_data_batch = next(data_iter)
+                    self.prepare(next_data_batch, sparse_row_id_fn=sparse_row_id_fn)
+                except StopIteration:
+                    end_of_batch = True
+
                 if monitor is not None:
                     monitor.toc_print()
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services