提交 dea1dd71 编写于 作者: S SunAhong1993

fix the normilize

上级 b7d294bf
......@@ -15,17 +15,16 @@ def normalize_layer(inputs,
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][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, \
shape=[1] if channel_shared else [input_shape[0][1]])
shape=[1] if channel_shared else [input_shape[0][0], 1, 1, input_shape[0][1]])
out = fluid.layers.elementwise_mul(x=l2_norm,
y=scale_param,
axis=-1 if channel_shared else 1)
return out
def normalize_weights(name, data=None):
weights_name = [name + '_scale']
return weights_name
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册