marcoabreu commented on a change in pull request #10435: [MXNET-289] Allow 
specifying number of batches to run in an epoch to fix hang in dist sync for 
last epoch
URL: https://github.com/apache/incubator-mxnet/pull/10435#discussion_r179932034
 
 

 ##########
 File path: python/mxnet/module/base_module.py
 ##########
 @@ -511,9 +514,12 @@ def fit(self, train_data, eval_data=None, 
eval_metric='acc',
                 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)
+                    if epoch_size and (nbatch == epoch_size - 1):
 
 Review comment:
   Please correct me if I'm wrong, but this would be an infinite loop if the 
epoch_size was negative or 0, right? To be resilient against mis-usage (maybe 
coming from automated scripts), please assert ```epoch_size``` is positive and 
add a test accordingly

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to