From d142d861a3c84155867905bc3cc49c14a993914c Mon Sep 17 00:00:00 2001 From: driftcloudy Date: Tue, 28 Jul 2020 11:16:53 +0800 Subject: [PATCH] =?UTF-8?q?caffe2paddle,=20support=20relu6/upsample?= =?UTF-8?q?=EF=BC=8Ccompatible=20with=20LeakyReLU=EF=BC=8Crepair=20axpy=20?= =?UTF-8?q?and=20dropout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- x2paddle/decoder/caffe_decoder.py | 33 --------------------------- x2paddle/op_mapper/caffe_op_mapper.py | 1 - 2 files changed, 34 deletions(-) diff --git a/x2paddle/decoder/caffe_decoder.py b/x2paddle/decoder/caffe_decoder.py index d9e926c..3d78365 100644 --- a/x2paddle/decoder/caffe_decoder.py +++ b/x2paddle/decoder/caffe_decoder.py @@ -88,39 +88,6 @@ class CaffeGraph(Graph): # filter them out here. if (not exclude) and (phase == 'test'): exclude = (type_str == 'Dropout') - ''' - 如果要去除Dropout Layer的话,原先这里写的不对,因为还得修正下一层Layer的bottom指向 - - 例如: - layer { - name: "pool_8x8_s1" - type: "Pooling" - bottom: "inception_c2_concat" - top: "pool_8x8_s1" - pooling_param { - pool: AVE - global_pooling: true - } - } - layer { - name: "pool_8x8_s1_drop" - type: "Dropout" - bottom: "pool_8x8_s1" - top: "pool_8x8_s1_drop" - dropout_param { - dropout_ratio: 0.2 - } - } - layer { - name: "classifier" - type: "InnerProduct" - bottom: "pool_8x8_s1_drop" - } - - 这种prototxt形式下,直接去除pool_8x8_s1_drop不行 - 会导致dropout的下一层找不到正确的bottom而报错 - 需要将下一层里的bottom指向dropout的上一层 - ''' if layer.type == 'Dropout': drop_layer_top = layer.top[0] drop_layer_bottom = layer.bottom[0] diff --git a/x2paddle/op_mapper/caffe_op_mapper.py b/x2paddle/op_mapper/caffe_op_mapper.py index 26e08cc..e3eb5fe 100644 --- a/x2paddle/op_mapper/caffe_op_mapper.py +++ b/x2paddle/op_mapper/caffe_op_mapper.py @@ -444,7 +444,6 @@ class CaffeOpMapper(OpMapper): node.inputs) == 1, 'The count of ReLU node\'s input is not 1.' input = self.graph.get_bottom_node(node, idx=0, copy=True) - # 如果存在negative_slope,则相当于 LeakyReLU params = node.layer.relu_param if params.HasField('negative_slope') and params.negative_slope != 0: negative_slope = float(params.negative_slope) -- GitLab