提交 b3838fbd 编写于 作者: S SunAhong1993

fix the normalize

上级 3718df76
...@@ -253,6 +253,7 @@ class CaffeDecoder(object): ...@@ -253,6 +253,7 @@ class CaffeDecoder(object):
else: else:
c_o, c_i, h, w = map(int, [1] * (4 - len(dims)) \ c_o, c_i, h, w = map(int, [1] * (4 - len(dims)) \
+ list(dims)) + list(dims))
else: else:
c_o = blob.num c_o = blob.num
c_i = blob.channels c_i = blob.channels
......
...@@ -12,12 +12,10 @@ def normalize_layer(inputs, ...@@ -12,12 +12,10 @@ def normalize_layer(inputs,
input_shape=None, input_shape=None,
name=None): name=None):
assert across_spatial == False, "Only support across_spatial == False for Normalize" assert across_spatial == False, "Only support across_spatial == False for Normalize"
input = inputs[0] input = inputs[0]
l2_norm = fluid.layers.l2_normalize(input, axis=1, name=name + '_l2') l2_norm = fluid.layers.l2_normalize(input, axis=1, name=name + '_l2')
scale_param = fluid.layers.create_parameter( scale_param = fluid.layers.create_parameter(
shape=[1] shape=[1] if channel_shared else [input_shape[0][1]],
if channel_shared else [input_shape[0][1]],
dtype=input.dtype, dtype=input.dtype,
attr=name + '_scale') attr=name + '_scale')
scale_param = fluid.layers.reshape(x=scale_param, \ scale_param = fluid.layers.reshape(x=scale_param, \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册