From 6048b066e5aadadb48edfe3e6187338c78e641d6 Mon Sep 17 00:00:00 2001 From: SunAhong1993 Date: Fri, 1 Nov 2019 15:45:10 +0800 Subject: [PATCH] fix the normilize --- x2paddle/op_mapper/caffe_custom_layer/normalize.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x2paddle/op_mapper/caffe_custom_layer/normalize.py b/x2paddle/op_mapper/caffe_custom_layer/normalize.py index 05a55c0..a63dc62 100644 --- a/x2paddle/op_mapper/caffe_custom_layer/normalize.py +++ b/x2paddle/op_mapper/caffe_custom_layer/normalize.py @@ -12,10 +12,12 @@ def normalize_layer(inputs, input_shape=None, name=None): assert across_spatial == False, "Only support across_spatial == False for Normalize" + input = inputs[0] l2_norm = fluid.layers.l2_normalize(input, axis=1, name=name + '_l2') scale_param = fluid.layers.create_parameter( - shape=[1] if channel_shared else [input_shape[0][0], 1, 1, input_shape[0][1]], + shape=[1] + if channel_shared else [input_shape[0][0], 1, 1, input_shape[0][1]], dtype=input.dtype, attr=name + '_scale') scale_param = fluid.layers.reshape(x=scale_param, \ @@ -25,6 +27,7 @@ def normalize_layer(inputs, axis=-1 if channel_shared else 1) return out + def normalize_weights(name, data=None): weights_name = [name + '_scale'] return weights_name -- GitLab