diff --git a/x2paddle/op_mapper/caffe2paddle/caffe_custom_layer/normalize.py b/x2paddle/op_mapper/caffe2paddle/caffe_custom_layer/normalize.py index db22d14b9c77bc6387adaf9c9decb5cf62d05b14..184df4c1cba2d85d72e828cb97f7e84a07926e22 100644 --- a/x2paddle/op_mapper/caffe2paddle/caffe_custom_layer/normalize.py +++ b/x2paddle/op_mapper/caffe2paddle/caffe_custom_layer/normalize.py @@ -20,7 +20,7 @@ class Normalize(object): self.axis = axis def __call__(self, x, param): - l2_norm = paddle.norm(x=x, p=2, axis=1) + l2_norm = paddle.norm(x=x, p=2, axis=1, keepdim=True) param = paddle.reshape(param, [param.shape[-1]]) perm = list(range(len(l2_norm.shape))) perm.pop(self.axis) diff --git a/x2paddle/op_mapper/caffe2paddle/caffe_op_mapper.py b/x2paddle/op_mapper/caffe2paddle/caffe_op_mapper.py index a9a9794b3380d2b9f88ce5542d91b36b081b28ab..8037308146c1752dc3b3270f0646a24e09e07124 100644 --- a/x2paddle/op_mapper/caffe2paddle/caffe_op_mapper.py +++ b/x2paddle/op_mapper/caffe2paddle/caffe_op_mapper.py @@ -429,10 +429,10 @@ class CaffeOpMapper(): assert params.local_size % 2 == 1 alpha = params.alpha / float(params.local_size) layer_attrs = { - "n": params.local_size, - "k": params.k, + "size": params.local_size, "alpha": alpha, "beta": params.beta, + "k": params.k, } self.paddle_graph.add_layer( "paddle.nn.LocalResponseNorm",