提交 e9735415 编写于 作者: P peterzhang2029

unify the bias

上级 2b93934d
...@@ -3649,9 +3649,10 @@ def gru_step_layer(input, ...@@ -3649,9 +3649,10 @@ def gru_step_layer(input,
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:param gate_act: Activation type of this layer's two gates. Default is Sigmoid. :param gate_act: Activation type of this layer's two gates. Default is Sigmoid.
:type gate_act: BaseActivation :type gate_act: BaseActivation
:param bias_attr: The bias attribute. If the parameter is set to False or an object :param bias_attr: The parameter attribute for bias. If this parameter is set to
whose type is not ParameterAttribute, no bias is defined. If the False or an object whose type is not ParameterAttribute, no bias
parameter is set to True, the bias is initialized to zero. is defined. If this parameter is set to True,
the bias is initialized to zero.
:type bias_attr: ParameterAttribute | None | bool | Any :type bias_attr: ParameterAttribute | None | bool | Any
:param param_attr: the parameter_attribute for transforming the output_mem :param param_attr: the parameter_attribute for transforming the output_mem
from previous step. from previous step.
...@@ -3711,9 +3712,10 @@ def gru_step_naive_layer(input, ...@@ -3711,9 +3712,10 @@ def gru_step_naive_layer(input,
:type act: BaseActivation :type act: BaseActivation
:param gate_act: Activation type of this layer's two gates. Default is Sigmoid. :param gate_act: Activation type of this layer's two gates. Default is Sigmoid.
:type gate_act: BaseActivation :type gate_act: BaseActivation
:param bias_attr: The bias attribute. If the parameter is set to False or an object :param bias_attr: The parameter attribute for bias. If this parameter is set to
whose type is not ParameterAttribute, no bias is defined. If the False or an object whose type is not ParameterAttribute, no bias
parameter is set to True, the bias is initialized to zero. is defined. If this parameter is set to True,
the bias is initialized to zero.
:type bias_attr: ParameterAttribute | None | bool | Any :type bias_attr: ParameterAttribute | None | bool | Any
:param param_attr: :param param_attr:
:param layer_attr: :param layer_attr:
...@@ -3843,9 +3845,10 @@ def recurrent_layer(input, ...@@ -3843,9 +3845,10 @@ def recurrent_layer(input,
:type input: LayerOutput :type input: LayerOutput
:param act: Activation type. TanhActivation is the default. :param act: Activation type. TanhActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param bias_attr: The bias attribute. If the parameter is set to False or an object :param bias_attr: The parameter attribute for bias. If this parameter is set to
whose type is not ParameterAttribute, no bias is defined. If the False or an object whose type is not ParameterAttribute,
parameter is set to True, the bias is initialized to zero. no bias is defined. If the parameter is set to True,
the bias is initialized to zero.
:type bias_attr: ParameterAttribute | None | bool | Any :type bias_attr: ParameterAttribute | None | bool | Any
:param param_attr: parameter attribute. :param param_attr: parameter attribute.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
...@@ -4835,9 +4838,10 @@ def tensor_layer(a, ...@@ -4835,9 +4838,10 @@ def tensor_layer(a,
:type act: BaseActivation :type act: BaseActivation
:param param_attr: The Parameter Attribute. :param param_attr: The Parameter Attribute.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
:param bias_attr: The bias attribute. If the parameter is set to False or an object :param bias_attr: The parameter attribute for bias. If this parameter is set to
whose type is not ParameterAttribute, no bias is defined. If the False or an object whose type is not ParameterAttribute,
parameter is set to True, the bias is initialized to zero. no bias is defined. If this parameter is set to True,
the bias is initialized to zero.
:type bias_attr: ParameterAttribute | None | bool | Any :type bias_attr: ParameterAttribute | None | bool | Any
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute | None :type layer_attr: ExtraLayerAttribute | None
...@@ -4899,9 +4903,10 @@ def selective_fc_layer(input, ...@@ -4899,9 +4903,10 @@ def selective_fc_layer(input,
:type act: BaseActivation :type act: BaseActivation
:param param_attr: The Parameter Attribute. :param param_attr: The Parameter Attribute.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
:param bias_attr: The bias attribute. If the parameter is set to False or an object :param bias_attr: The parameter attribute for bias. If this parameter is set to
whose type is not ParameterAttribute, no bias is defined. If the False or an object whose type is not ParameterAttribute,
parameter is set to True, the bias is initialized to zero. no bias is defined. If this parameter is set to True,
the bias is initialized to zero.
:type bias_attr: ParameterAttribute | None | bool | Any :type bias_attr: ParameterAttribute | None | bool | Any
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute | None :type layer_attr: ExtraLayerAttribute | None
...@@ -5584,10 +5589,10 @@ def nce_layer(input, ...@@ -5584,10 +5589,10 @@ def nce_layer(input,
to the num_classes. Each member of the list defines to the num_classes. Each member of the list defines
the probability of a class given input x. the probability of a class given input x.
:type neg_distribution: list | tuple | collections.Sequence | None :type neg_distribution: list | tuple | collections.Sequence | None
:param bias_attr: The attribute for bias. If this parameter is set False or :param bias_attr: The parameter attribute for bias. If this parameter is set to
any object whose type is not ParameterAttribute, no bias False or an object whose type is not ParameterAttribute,
is added. If this parameter is set True, the bias is no bias is defined. If this parameter is set to True,
initialized to zero. the bias is initialized to zero.
:type bias_attr: ParameterAttribute | None | bool | Any :type bias_attr: ParameterAttribute | None | bool | Any
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
...@@ -6497,9 +6502,9 @@ def gated_unit_layer(input, ...@@ -6497,9 +6502,9 @@ def gated_unit_layer(input,
:param gate_param_attr: The parameter attribute of the gate. See ParameterAttribute :param gate_param_attr: The parameter attribute of the gate. See ParameterAttribute
for details. for details.
:type gate_param_attr: ParameterAttribute :type gate_param_attr: ParameterAttribute
:param gate_bias_attr: The bias attribute of the gate. If the parameter is set to False or :param gate_bias_attr: The bias attribute of the gate. If this parameter is set to False or
an object whose type is not ParameterAttribute, no bias is defined. an object whose type is not ParameterAttribute, no bias is defined.
If the parameter is set to True, the bias is initialized to zero. If this parameter is set to True, the bias is initialized to zero.
:type gate_bias_attr: ParameterAttribute | bool | None | Any :type gate_bias_attr: ParameterAttribute | bool | None | Any
:param inproj_attr: Extra layer attributes of the projection. See ExtraLayerAttribute for :param inproj_attr: Extra layer attributes of the projection. See ExtraLayerAttribute for
details. details.
...@@ -6507,9 +6512,9 @@ def gated_unit_layer(input, ...@@ -6507,9 +6512,9 @@ def gated_unit_layer(input,
:param inproj_param_attr: The parameter attribute of the projection. See ParameterAttribute :param inproj_param_attr: The parameter attribute of the projection. See ParameterAttribute
for details. for details.
:type inproj_param_attr: ParameterAttribute :type inproj_param_attr: ParameterAttribute
:param inproj_bias_attr: The bias attribute of the projection. If the parameter is set to False :param inproj_bias_attr: The bias attribute of the projection. If this parameter is set to False
or an object whose type is not ParameterAttribute, no bias is defined. or an object whose type is not ParameterAttribute, no bias is defined.
If the parameter is set to True, the bias is initialized to zero. If this parameter is set to True, the bias is initialized to zero.
:type inproj_bias_attr: ParameterAttribute | bool | None | Any :type inproj_bias_attr: ParameterAttribute | bool | None | Any
:param layer_attr: Extra layer attribute of the product. See ExtraLayerAttribute for :param layer_attr: Extra layer attribute of the product. See ExtraLayerAttribute for
details. details.
......
...@@ -681,36 +681,42 @@ def lstmemory_unit(input, ...@@ -681,36 +681,42 @@ def lstmemory_unit(input,
state_act=TanhActivation()) state_act=TanhActivation())
:param input: input layer. :param input: Input layer.
:type input: LayerOutput :type input: LayerOutput
:param out_memory: output of previous time step :param out_memory: The output of previous time step.
:type out_memory: LayerOutput | None :type out_memory: LayerOutput | None
:param name: lstmemory unit name. :param name: The lstmemory unit name.
:type name: basestring :type name: basestring
:param size: lstmemory unit size. :param size: The lstmemory unit size.
:type size: int :type size: int
:param param_attr: parameter attribute, None means default attribute. :param param_attr: The parameter attribute for the weights in
input to hidden projection.
None means default attribute.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
:param act: last activiation type of lstm. :param act: The last activiation type of lstm.
:type act: BaseActivation :type act: BaseActivation
:param gate_act: gate activiation type of lstm. :param gate_act: The gate activiation type of lstm.
:type gate_act: BaseActivation :type gate_act: BaseActivation
:param state_act: state activiation type of lstm. :param state_act: The state activiation type of lstm.
:type state_act: BaseActivation :type state_act: BaseActivation
:param input_proj_bias_attr: bias attribute for input to hidden projection. :param input_proj_bias_attr: The parameter attribute for the bias in
False or None means no bias. If the parameter is set to True, input to hidden projection.
False or None means no bias.
If this parameter is set to True,
the bias is initialized to zero. the bias is initialized to zero.
:type input_proj_bias_attr: ParameterAttribute|bool|None :type input_proj_bias_attr: ParameterAttribute|bool|None
:param input_proj_layer_attr: extra layer attribute for input to hidden :param input_proj_layer_attr: The extra layer attribute for
projection of the LSTM unit, such as dropout, error clipping. input to hidden projection of the LSTM unit,
such as dropout, error clipping.
:type input_proj_layer_attr: ExtraLayerAttribute :type input_proj_layer_attr: ExtraLayerAttribute
:param lstm_bias_attr: bias parameter attribute of lstm layer. :param lstm_bias_attr: The parameter attribute for the bias in lstm layer.
If the parameter is set to True or None, False or None means no bias.
If this parameter is set to True,
the bias is initialized to zero. the bias is initialized to zero.
:type lstm_bias_attr: ParameterAttribute|True|None :type lstm_bias_attr: ParameterAttribute|True|None
:param lstm_layer_attr: extra attribute of lstm layer. :param lstm_layer_attr: The extra attribute of lstm layer.
:type lstm_layer_attr: ExtraLayerAttribute :type lstm_layer_attr: ExtraLayerAttribute
:return: lstmemory unit name. :return: The lstmemory unit name.
:rtype: LayerOutput :rtype: LayerOutput
""" """
if size is None: if size is None:
...@@ -788,36 +794,42 @@ def lstmemory_group(input, ...@@ -788,36 +794,42 @@ def lstmemory_group(input,
gate_act=SigmoidActivation(), gate_act=SigmoidActivation(),
state_act=TanhActivation()) state_act=TanhActivation())
:param input: input layer. :param input: Input layer.
:type input: LayerOutput :type input: LayerOutput
:param size: lstmemory group size. :param size: The lstmemory group size.
:type size: int :type size: int
:param name: name of lstmemory group. :param name: The name of lstmemory group.
:type name: basestring :type name: basestring
:param out_memory: output of previous time step. :param out_memory: The output of previous time step.
:type out_memory: LayerOutput | None :type out_memory: LayerOutput | None
:param reverse: process the input in a reverse order or not. :param reverse: Process the input in a reverse order or not.
:type reverse: bool :type reverse: bool
:param param_attr: parameter attribute, None means default attribute. :param param_attr: The parameter attribute for the weights in
input to hidden projection.
None means default attribute.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
:param act: last activiation type of lstm. :param act: The last activiation type of lstm.
:type act: BaseActivation :type act: BaseActivation
:param gate_act: gate activiation type of lstm. :param gate_act: The gate activiation type of lstm.
:type gate_act: BaseActivation :type gate_act: BaseActivation
:param state_act: state activiation type of lstm. :param state_act: The state activiation type of lstm.
:type state_act: BaseActivation :type state_act: BaseActivation
:param lstm_bias_attr: bias parameter attribute of lstm layer. :param input_proj_bias_attr: The parameter attribute for the bias in
If the parameter is set to True or None, the bias is input to hidden projection.
initialized to zero. False or None means no bias.
:type lstm_bias_attr: ParameterAttribute|True|None If this parameter is set to True,
:param input_proj_bias_attr: bias attribute for input to hidden projection.
False or None means no bias. If the parameter is set to True,
the bias is initialized to zero. the bias is initialized to zero.
:type input_proj_bias_attr: ParameterAttribute|bool|None :type input_proj_bias_attr: ParameterAttribute|bool|None
:param input_proj_layer_attr: extra layer attribute for input to hidden :param input_proj_layer_attr: The extra layer attribute for
projection of the LSTM unit, such as dropout, error clipping. input to hidden projection of the LSTM unit,
such as dropout, error clipping.
:type input_proj_layer_attr: ExtraLayerAttribute :type input_proj_layer_attr: ExtraLayerAttribute
:param lstm_layer_attr: lstm layer's extra attribute. :param lstm_bias_attr: The parameter attribute for the bias in lstm layer.
False or None means no bias.
If this parameter is set to True,
the bias is initialized to zero.
:type lstm_bias_attr: ParameterAttribute|True|None
:param lstm_layer_attr: The extra attribute of lstm layer.
:type lstm_layer_attr: ExtraLayerAttribute :type lstm_layer_attr: ExtraLayerAttribute
:return: the lstmemory group. :return: the lstmemory group.
:rtype: LayerOutput :rtype: LayerOutput
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册