This is an automated email from the ASF dual-hosted git repository.

jxie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 6abcdbb  [MXNET-171] Fix a bug that was causing training accuracy to 
be printed as nan sometimes (#10437)
6abcdbb is described below

commit 6abcdbb3333979d2aa8d7c3c7253762e921ba478
Author: Indu Bharathi <indhubhara...@gmail.com>
AuthorDate: Mon Apr 9 09:56:54 2018 -0700

    [MXNET-171] Fix a bug that was causing training accuracy to be printed as 
nan sometimes (#10437)
    
    * Fix a bug that was causing training accuracy to be printed as nan 
sometimes.
    
    * Avoid the additional 'arg_eval_metric' variable. There should be no
    overhead except for the batch in an epoch.
    
    * Fix lint.
    
    * For the last batch, Capture metrics before callback and use it to print 
epoch metrics
    
    * Remove unused import
---
 python/mxnet/module/base_module.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/python/mxnet/module/base_module.py 
b/python/mxnet/module/base_module.py
index c03f8e7..8f5fd4a 100644
--- a/python/mxnet/module/base_module.py
+++ b/python/mxnet/module/base_module.py
@@ -522,6 +522,9 @@ class BaseModule(object):
                 if monitor is not None:
                     monitor.toc_print()
 
+                if end_of_batch:
+                    eval_name_vals = eval_metric.get_name_value()
+
                 if batch_end_callback is not None:
                     batch_end_params = BatchEndParam(epoch=epoch, 
nbatch=nbatch,
                                                      eval_metric=eval_metric,
@@ -531,7 +534,7 @@ class BaseModule(object):
                 nbatch += 1
 
             # one epoch of training is finished
-            for name, val in eval_metric.get_name_value():
+            for name, val in eval_name_vals:
                 self.logger.info('Epoch[%d] Train-%s=%f', epoch, name, val)
             toc = time.time()
             self.logger.info('Epoch[%d] Time cost=%.3f', epoch, (toc-tic))

-- 
To stop receiving notification emails like this one, please contact
j...@apache.org.

Reply via email to