indhub commented on issue #4253: training-accuracy nan
URL: 
https://github.com/apache/incubator-mxnet/issues/4253#issuecomment-379191428
 
 
   This should fix it:
   ```
   diff --git a/python/mxnet/module/base_module.py 
b/python/mxnet/module/base_module.py
   index c03f8e7..10b3e75 100644
   --- a/python/mxnet/module/base_module.py
   +++ b/python/mxnet/module/base_module.py
   @@ -22,6 +22,7 @@
    import time
    import logging
    import warnings
   +from copy import deepcopy
    
    from .. import metric
    from .. import ndarray
   @@ -523,8 +524,9 @@ class BaseModule(object):
                        monitor.toc_print()
    
                    if batch_end_callback is not None:
   +                    arg_eval_metric = eval_metric if not end_of_batch else 
deepcopy(eval_metric)
                        batch_end_params = BatchEndParam(epoch=epoch, 
nbatch=nbatch,
   -                                                     
eval_metric=eval_metric,
   +                                                     
eval_metric=arg_eval_metric,
                                                         locals=locals())
                        for callback in _as_list(batch_end_callback):
                            callback(batch_end_params)
   
   ```

----------------------------------------------------------------
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