SINGA-369 the errors of examples in testing
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/c5b454d1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/c5b454d1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/c5b454d1 Branch: refs/heads/master Commit: c5b454d1e231c6cf80186b2c99c1b332188e1b98 Parents: 01ed877 Author: sheyujian <[email protected]> Authored: Sun May 20 17:09:45 2018 +0800 Committer: sheyujian <[email protected]> Committed: Sun May 20 17:09:45 2018 +0800 ---------------------------------------------------------------------- examples/imagenet/googlenet/serve.py | 2 +- python/singa/net.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/c5b454d1/examples/imagenet/googlenet/serve.py ---------------------------------------------------------------------- diff --git a/examples/imagenet/googlenet/serve.py b/examples/imagenet/googlenet/serve.py index 35b0c86..809e6cb 100644 --- a/examples/imagenet/googlenet/serve.py +++ b/examples/imagenet/googlenet/serve.py @@ -148,7 +148,7 @@ def create_net(shape, weight_path='bvlc_googlenet.pickle'): # layer for key, val in zip(net.param_names(), net.param_values()): # print key - if key == 'loss3/classifier_weight': + if key == 'loss3/classifier_weight' or key == 'loss3/classifier/weight': tmp = tensor.to_numpy(val) tmp = tmp.reshape(tmp.shape[::-1]) val.copy_from_numpy(np.transpose(tmp)) http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/c5b454d1/python/singa/net.py ---------------------------------------------------------------------- diff --git a/python/singa/net.py b/python/singa/net.py index 8d6bc85..12b0ead 100644 --- a/python/singa/net.py +++ b/python/singa/net.py @@ -239,15 +239,21 @@ class FeedForwardNet(object): output layers. Currently only support nets with a single output layer + TODO(yujian) to handle multiple outputs from the network Args: x: input data, a single input Tensor or a dict: layer name -> Tensor Returns: a single output tensor as the prediction result. + ''' + xx = self.forward(kEval, x) - return tensor.softmax(xx) + if type(xx) is dict: + return tensor.softmax(list(xx.values())[0]) + else: + return tensor.softmax(xx) def topo_sort(self, layers, src_of_layer): '''Topology sort of layers.
