提交 bc9f4c55 编写于 作者: C Cao Ying 提交者: GitHub

Merge pull request #4039 from lcy-seso/fix_prelu_parse

fix bug in prelu parsing.
......@@ -2034,6 +2034,7 @@ class ParameterReluLayer(LayerBase):
config_assert(input_layer.size % partial_sum == 0,
"a wrong setting for partial_sum")
self.set_layer_size(input_layer.size)
self.config.partial_sum = partial_sum
self.create_input_parameter(0, input_layer.size / partial_sum)
......
......@@ -14,6 +14,29 @@ layers {
input_layer_name: "input"
input_parameter_name: "___prelu_layer_0__.w0"
}
partial_sum: 1
}
layers {
name: "__prelu_layer_1__"
type: "prelu"
size: 300
active_type: ""
inputs {
input_layer_name: "input"
input_parameter_name: "___prelu_layer_1__.w0"
}
partial_sum: 1
}
layers {
name: "__prelu_layer_2__"
type: "prelu"
size: 300
active_type: ""
inputs {
input_layer_name: "input"
input_parameter_name: "___prelu_layer_2__.w0"
}
partial_sum: 5
}
parameters {
name: "___prelu_layer_0__.w0"
......@@ -23,14 +46,32 @@ parameters {
initial_strategy: 0
initial_smart: true
}
parameters {
name: "___prelu_layer_1__.w0"
size: 300
initial_mean: 0.0
initial_std: 0.057735026919
initial_strategy: 0
initial_smart: true
}
parameters {
name: "___prelu_layer_2__.w0"
size: 60
initial_mean: 0.0
initial_std: 0.129099444874
initial_strategy: 0
initial_smart: true
}
input_layer_names: "input"
output_layer_names: "__prelu_layer_0__"
output_layer_names: "__prelu_layer_2__"
sub_models {
name: "root"
layer_names: "input"
layer_names: "__prelu_layer_0__"
layer_names: "__prelu_layer_1__"
layer_names: "__prelu_layer_2__"
input_layer_names: "input"
output_layer_names: "__prelu_layer_0__"
output_layer_names: "__prelu_layer_2__"
is_recurrent_layer_group: false
}
......@@ -2,5 +2,7 @@ from paddle.trainer_config_helpers import *
data = data_layer(name='input', size=300)
prelu = prelu_layer(input=data)
prelu = prelu_layer(input=data, partial_sum=1)
prelu = prelu_layer(input=data, partial_sum=5)
outputs(prelu)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册