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 f65da2c Update metric.py (#7995)
f65da2c is described below
commit f65da2ca48f3a8d4739111ef34bfb26c21142bc8
Author: solin319 <[email protected]>
AuthorDate: Thu Sep 28 00:57:56 2017 +0800
Update metric.py (#7995)
---
python/mxnet/metric.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/python/mxnet/metric.py b/python/mxnet/metric.py
index 1b192f2..55d9859 100644
--- a/python/mxnet/metric.py
+++ b/python/mxnet/metric.py
@@ -390,13 +390,13 @@ class Accuracy(EvalMetric):
for label, pred_label in zip(labels, preds):
if pred_label.shape != label.shape:
pred_label = ndarray.argmax(pred_label, axis=self.axis)
- label = label.astype('int32')
- pred_label =
pred_label.astype('int32').as_in_context(label.context)
+ pred_label = pred_label.asnumpy().astype('int32')
+ label = label.asnumpy().astype('int32')
check_label_shapes(label, pred_label)
- self.sum_metric += ndarray.sum(label == pred_label).asscalar()
- self.num_inst += label.size
+ self.sum_metric += (pred_label.flat == label.flat).sum()
+ self.num_inst += len(pred_label.flat)
@register
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].