From bc5eae49b33ec52272057dececa2d6518b22fce0 Mon Sep 17 00:00:00 2001 From: Renwb1991 <1534609090@qq.com> Date: Mon, 28 Jan 2019 16:26:20 +0800 Subject: [PATCH] caffe2fluid: repair scale layer --- caffe2fluid/kaffe/paddle/network.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/caffe2fluid/kaffe/paddle/network.py b/caffe2fluid/kaffe/paddle/network.py index 718bd19..883b24c 100644 --- a/caffe2fluid/kaffe/paddle/network.py +++ b/caffe2fluid/kaffe/paddle/network.py @@ -439,24 +439,24 @@ class Network(object): need_transpose = True if need_transpose: - order = range(dims) - order.remove(axis) - order.append(axis) + in_order = range(dims) + in_order.remove(axis) + in_order.append(axis) input = fluid.layers.transpose( input, - perm=order, + perm=in_order, name=self.get_unique_output_name(name, 'transpose')) output = fluid.layers.softmax( input, name=self.get_unique_output_name(name, 'softmax')) if need_transpose: - order = range(len(shape)) - order[axis] = dims - 1 - order[-1] = axis + out_order = [0, ] * dims + for id, v in enumerate(in_order): + out_order[v] = id output = fluid.layers.transpose( output, - perm=order, + perm=out_order, name=self.get_unique_output_name(name, 'transpose')) return output -- GitLab