Repository: incubator-singa Updated Branches: refs/heads/master 97781d046 -> 0be3e03a8
fix a bug when provided metric is None Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/f7caf468 Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/f7caf468 Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/f7caf468 Branch: refs/heads/master Commit: f7caf46811901251f2c03347f137e83f065bde90 Parents: de8a654 Author: RUAN0007 <[email protected]> Authored: Wed Feb 22 21:45:49 2017 +0800 Committer: RUAN0007 <[email protected]> Committed: Wed Feb 22 21:50:44 2017 +0800 ---------------------------------------------------------------------- python/singa/net.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/f7caf468/python/singa/net.py ---------------------------------------------------------------------- diff --git a/python/singa/net.py b/python/singa/net.py index 26fb61d..2be8d95 100644 --- a/python/singa/net.py +++ b/python/singa/net.py @@ -179,7 +179,9 @@ class FeedForwardNet(object): l = self.loss.forward(kTrain, out, y) if self.metric is not None: m = self.metric.evaluate(out, y) - return self.backward(), (l.l1(), m) + return self.backward(), (l.l1(), m) + else: + return self.backward(), (l.l1(),None) def evaluate(self, x, y): '''Evaluate the loss and metric of the given data.
