ptrendx commented on a change in pull request #13471: Optimization of metric 
evaluation
URL: https://github.com/apache/incubator-mxnet/pull/13471#discussion_r240339789
 
 

 ##########
 File path: python/mxnet/metric.py
 ##########
 @@ -423,8 +501,11 @@ def update(self, labels, preds):
 
             check_label_shapes(label, pred_label)
 
-            self.sum_metric += (pred_label == label).sum()
+            num_correct = (pred_label == label).sum()
+            self.sum_metric += num_correct
+            self.global_sum_metric += num_correct
 
 Review comment:
   They will be different when you call `reset_local` (which is called from 
`Speedometer` for example) - this will reset the local versions of metrics 
while keeping the global versions intact (which was the point of this PR - to 
enable computing both per-batch and per-epoch statistics using only single 
computation).

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to