diff --git a/python/paddle/trainer/config_parser.py b/python/paddle/trainer/config_parser.py index 54245ff03e2029bb2f1208ae9126ad65d40c5e83..43b83b48239974f801d6901d2c3ccbcd08eb13b7 100644 --- a/python/paddle/trainer/config_parser.py +++ b/python/paddle/trainer/config_parser.py @@ -2048,6 +2048,7 @@ class ParameterReluLayer(LayerBase): def __init__(self, name, inputs, partial_sum=1, **args): super(ParameterReluLayer, self).__init__( name, self.layer_type, 0, inputs=inputs, **args) + input_layer = self.get_input_layer(0) config_assert(len(self.inputs) == 1, "prelu layer has only one input.") config_assert(input_layer.size % partial_sum == 0, diff --git a/python/paddle/trainer_config_helpers/layers.py b/python/paddle/trainer_config_helpers/layers.py index ccd9a728cf2c2781132f7a5884415c104176e887..5ace7598dc6bc9119b8fad947588a56c6de48e97 100644 --- a/python/paddle/trainer_config_helpers/layers.py +++ b/python/paddle/trainer_config_helpers/layers.py @@ -6442,9 +6442,9 @@ def prelu_layer(input, """ assert isinstance(input, LayerOutput), 'prelu_layer accepts only one input.' + if not param_attr: - param_attr = ParamAttr(initial_mean=0.25, - initial_std=0.0) + param_attr = ParamAttr(initial_mean=0.25, initial_std=0.0) else: assert isinstance(param_attr, ParameterAttribute) @@ -6469,7 +6469,7 @@ def prelu_layer(input, name=name, layer_type=LayerType.PRELU, parents=input, - num_filters = num_channels, + num_filters=num_channels, size=l.config.size)