diff --git a/x2paddle/decoder/caffe_decoder.py b/x2paddle/decoder/caffe_decoder.py index 4174cc2032b22d335f7bf9a058ac939abb9ad735..f9ad281dec8b2abfd7c59f1ed241b7451adf8c71 100644 --- a/x2paddle/decoder/caffe_decoder.py +++ b/x2paddle/decoder/caffe_decoder.py @@ -104,6 +104,8 @@ class CaffeGraph(Graph): if not exclude: filtered_layers.append(layer) # Guard against dupes. + if layer.name in filtered_layer_names: + layer.name += "_0" assert layer.name not in filtered_layer_names filtered_layer_names.add(layer.name) else: @@ -224,7 +226,7 @@ class CaffeGraph(Graph): assert input_node_name in self.node_map, 'The {} isn\'t a valid node'.format( name) input_node = self.node_map[input_node_name] - if len(input_node.layer.top) > 1: + if len(input_node.layer.top) > 1 and input_node.layer_type != "Input": need_idx = list(input_node.layer.top).index(node.layer.bottom[idx]) name = input_node_name + ':' + str(need_idx) else: diff --git a/x2paddle/op_mapper/caffe_op_mapper.py b/x2paddle/op_mapper/caffe_op_mapper.py index 4283bfecab13437172be4ec3402c4620642509f7..3e1377650c81a815a3b3d71a33717f447789d523 100644 --- a/x2paddle/op_mapper/caffe_op_mapper.py +++ b/x2paddle/op_mapper/caffe_op_mapper.py @@ -81,7 +81,6 @@ class CaffeOpMapper(OpMapper): input_shape.append(last_node.output_shape[idx]) node.input_shape = input_shape - func_name = 'shape_' + node.layer_type.lower() if is_fluid_op: node.output_shape = getattr(caffe_shape, func_name)(node.layer,