From 584aa97577b337ad8ce235635ec928f33547ef3f Mon Sep 17 00:00:00 2001 From: channingss Date: Sun, 27 Sep 2020 11:50:39 +0800 Subject: [PATCH] fix the prelu for caffe --- x2paddle/op_mapper/caffe_op_mapper.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/x2paddle/op_mapper/caffe_op_mapper.py b/x2paddle/op_mapper/caffe_op_mapper.py index 1ec79dd..4283bfe 100644 --- a/x2paddle/op_mapper/caffe_op_mapper.py +++ b/x2paddle/op_mapper/caffe_op_mapper.py @@ -467,7 +467,12 @@ class CaffeOpMapper(OpMapper): data = node.data assert data is not None, 'The parameter of {} (type is {}) is not set. You need to use python package of caffe to set the default value.'.format( node.layer_name, node.layer_type) - self.weights[node.layer_name + '_weights'] = data[0] + import paddle + pd_version = paddle.__version__ + if pd_version.startswith("1.8.4") or pd_version.startswith("1.8.3"): + self.weights[node.layer_name + '_weights'] = data[0].reshape(1, -1) + else: + self.weights[node.layer_name + '_weights'] = data[0] attr = { 'mode': string(mode), 'param_attr': string(node.layer_name + '_weights'), -- GitLab