From 0a209d49851d5c08a0db944ee4e55dfb2d3633f5 Mon Sep 17 00:00:00 2001 From: SunAhong1993 Date: Wed, 4 Nov 2020 15:26:59 +0800 Subject: [PATCH] fix the satic bug --- .../op_mapper/static/caffe2paddle/caffe_op_mapper.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/x2paddle/op_mapper/static/caffe2paddle/caffe_op_mapper.py b/x2paddle/op_mapper/static/caffe2paddle/caffe_op_mapper.py index c4b6c5b..e77a1c3 100644 --- a/x2paddle/op_mapper/static/caffe2paddle/caffe_op_mapper.py +++ b/x2paddle/op_mapper/static/caffe2paddle/caffe_op_mapper.py @@ -190,7 +190,7 @@ class CaffeOpMapper(OpMapper): def get_input_name(self, node): if hasattr(node, "index"): - return node.layer_name + "[{}]".format(node.index) + return "{}_{}".format(node.layer_name, node.index) else: return node.layer_name @@ -423,9 +423,11 @@ class CaffeOpMapper(OpMapper): if slice_dim != 1 and axis == 1: axis = slice_dim output_shape = node.output_shape - sections_list = [] - for s in output_shape: + sections_list = list() + outputs_list = list() + for i, s in enumerate(output_shape): sections_list.append(s[axis]) + outputs_list.append("{}_{}".format(node.layer_name, i)) layer_attrs = { 'num_or_sections': sections_list, 'dim': axis, @@ -434,7 +436,7 @@ class CaffeOpMapper(OpMapper): self.paddle_graph.add_layer( kernel="fluid.layers.split", inputs={"input": self.get_input_name(input)}, - outputs=[node.layer_name], + outputs=outputs_list, **layer_attrs) def Concat(self, node): @@ -958,7 +960,7 @@ class CaffeOpMapper(OpMapper): kwargs[k]["top_k"] = v.top_k kwargs[k]["eta"] = v.eta self.paddle_graph.add_layer( - kernel="combination_layer:{}".format(op), + kernel="custom_layer:{}".format(op), inputs={"inputs": inputs_list}, outputs=[node.layer_name], **kwargs) -- GitLab