Skip to content

Commit f06d8f0

Browse files
Merge pull request #5622 from peterzhang2029/notation_fix
Fix error in networks' docstrings .
2 parents 7345de3 + e973541 commit f06d8f0

File tree

2 files changed

+83
-63
lines changed

2 files changed

+83
-63
lines changed

python/paddle/trainer_config_helpers/layers.py

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3592,10 +3592,9 @@ def lstm_step_layer(input,
35923592
:type gate_act: BaseActivation
35933593
:param state_act: State Activation Type. TanhActivation is the default.
35943594
:type state_act: BaseActivation
3595-
:param bias_attr: The bias attribute. If the parameter is set to False or an object
3596-
whose type is not ParameterAttribute, no bias is defined. If the
3597-
parameter is set to True, the bias is initialized to zero.
3598-
:type bias_attr: ParameterAttribute | None | bool | Any
3595+
:param bias_attr: The parameter attribute for bias. If this parameter is
3596+
set to True or None, the bias is initialized to zero.
3597+
:type bias_attr: ParameterAttribute | None | True
35993598
:param layer_attr: layer's extra attribute.
36003599
:type layer_attr: ExtraLayerAttribute
36013600
:return: LayerOutput object.
@@ -3650,9 +3649,10 @@ def gru_step_layer(input,
36503649
:param name: The name of this layer. It is optional.
36513650
:param gate_act: Activation type of this layer's two gates. Default is Sigmoid.
36523651
:type gate_act: BaseActivation
3653-
:param bias_attr: The bias attribute. If the parameter is set to False or an object
3654-
whose type is not ParameterAttribute, no bias is defined. If the
3655-
parameter is set to True, the bias is initialized to zero.
3652+
:param bias_attr: The parameter attribute for bias. If this parameter is set to
3653+
False or an object whose type is not ParameterAttribute, no bias
3654+
is defined. If this parameter is set to True,
3655+
the bias is initialized to zero.
36563656
:type bias_attr: ParameterAttribute | None | bool | Any
36573657
:param param_attr: the parameter_attribute for transforming the output_mem
36583658
from previous step.
@@ -3712,9 +3712,10 @@ def gru_step_naive_layer(input,
37123712
:type act: BaseActivation
37133713
:param gate_act: Activation type of this layer's two gates. Default is Sigmoid.
37143714
:type gate_act: BaseActivation
3715-
:param bias_attr: The bias attribute. If the parameter is set to False or an object
3716-
whose type is not ParameterAttribute, no bias is defined. If the
3717-
parameter is set to True, the bias is initialized to zero.
3715+
:param bias_attr: The parameter attribute for bias. If this parameter is set to
3716+
False or an object whose type is not ParameterAttribute, no bias
3717+
is defined. If this parameter is set to True,
3718+
the bias is initialized to zero.
37183719
:type bias_attr: ParameterAttribute | None | bool | Any
37193720
:param param_attr:
37203721
:param layer_attr:
@@ -3844,9 +3845,10 @@ def recurrent_layer(input,
38443845
:type input: LayerOutput
38453846
:param act: Activation type. TanhActivation is the default.
38463847
:type act: BaseActivation
3847-
:param bias_attr: The bias attribute. If the parameter is set to False or an object
3848-
whose type is not ParameterAttribute, no bias is defined. If the
3849-
parameter is set to True, the bias is initialized to zero.
3848+
:param bias_attr: The parameter attribute for bias. If this parameter is set to
3849+
False or an object whose type is not ParameterAttribute,
3850+
no bias is defined. If the parameter is set to True,
3851+
the bias is initialized to zero.
38503852
:type bias_attr: ParameterAttribute | None | bool | Any
38513853
:param param_attr: parameter attribute.
38523854
:type param_attr: ParameterAttribute
@@ -4836,9 +4838,10 @@ def tensor_layer(a,
48364838
:type act: BaseActivation
48374839
:param param_attr: The Parameter Attribute.
48384840
:type param_attr: ParameterAttribute
4839-
:param bias_attr: The bias attribute. If the parameter is set to False or an object
4840-
whose type is not ParameterAttribute, no bias is defined. If the
4841-
parameter is set to True, the bias is initialized to zero.
4841+
:param bias_attr: The parameter attribute for bias. If this parameter is set to
4842+
False or an object whose type is not ParameterAttribute,
4843+
no bias is defined. If this parameter is set to True,
4844+
the bias is initialized to zero.
48424845
:type bias_attr: ParameterAttribute | None | bool | Any
48434846
:param layer_attr: Extra Layer config.
48444847
:type layer_attr: ExtraLayerAttribute | None
@@ -4900,9 +4903,10 @@ def selective_fc_layer(input,
49004903
:type act: BaseActivation
49014904
:param param_attr: The Parameter Attribute.
49024905
:type param_attr: ParameterAttribute
4903-
:param bias_attr: The bias attribute. If the parameter is set to False or an object
4904-
whose type is not ParameterAttribute, no bias is defined. If the
4905-
parameter is set to True, the bias is initialized to zero.
4906+
:param bias_attr: The parameter attribute for bias. If this parameter is set to
4907+
False or an object whose type is not ParameterAttribute,
4908+
no bias is defined. If this parameter is set to True,
4909+
the bias is initialized to zero.
49064910
:type bias_attr: ParameterAttribute | None | bool | Any
49074911
:param layer_attr: Extra Layer config.
49084912
:type layer_attr: ExtraLayerAttribute | None
@@ -5585,10 +5589,10 @@ def nce_layer(input,
55855589
to the num_classes. Each member of the list defines
55865590
the probability of a class given input x.
55875591
:type neg_distribution: list | tuple | collections.Sequence | None
5588-
:param bias_attr: The attribute for bias. If this parameter is set False or
5589-
any object whose type is not ParameterAttribute, no bias
5590-
is added. If this parameter is set True, the bias is
5591-
initialized to zero.
5592+
:param bias_attr: The parameter attribute for bias. If this parameter is set to
5593+
False or an object whose type is not ParameterAttribute,
5594+
no bias is defined. If this parameter is set to True,
5595+
the bias is initialized to zero.
55925596
:type bias_attr: ParameterAttribute | None | bool | Any
55935597
:param layer_attr: Extra Layer Attribute.
55945598
:type layer_attr: ExtraLayerAttribute
@@ -6498,19 +6502,19 @@ def gated_unit_layer(input,
64986502
:param gate_param_attr: The parameter attribute of the gate. See ParameterAttribute
64996503
for details.
65006504
:type gate_param_attr: ParameterAttribute
6501-
:param gate_bias_attr: The bias attribute of the gate. If the parameter is set to False or
6505+
:param gate_bias_attr: The bias attribute of the gate. If this parameter is set to False or
65026506
an object whose type is not ParameterAttribute, no bias is defined.
6503-
If the parameter is set to True, the bias is initialized to zero.
6507+
If this parameter is set to True, the bias is initialized to zero.
65046508
:type gate_bias_attr: ParameterAttribute | bool | None | Any
65056509
:param inproj_attr: Extra layer attributes of the projection. See ExtraLayerAttribute for
65066510
details.
65076511
:type inproj_attr: ExtraLayerAttribute | None
65086512
:param inproj_param_attr: The parameter attribute of the projection. See ParameterAttribute
65096513
for details.
65106514
:type inproj_param_attr: ParameterAttribute
6511-
:param inproj_bias_attr: The bias attribute of the projection. If the parameter is set to False
6515+
:param inproj_bias_attr: The bias attribute of the projection. If this parameter is set to False
65126516
or an object whose type is not ParameterAttribute, no bias is defined.
6513-
If the parameter is set to True, the bias is initialized to zero.
6517+
If this parameter is set to True, the bias is initialized to zero.
65146518
:type inproj_bias_attr: ParameterAttribute | bool | None | Any
65156519
:param layer_attr: Extra layer attribute of the product. See ExtraLayerAttribute for
65166520
details.

python/paddle/trainer_config_helpers/networks.py

Lines changed: 52 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -681,34 +681,42 @@ def lstmemory_unit(input,
681681
state_act=TanhActivation())
682682
683683
684-
:param input: input layer.
684+
:param input: Input layer.
685685
:type input: LayerOutput
686-
:param out_memory: output of previous time step
686+
:param out_memory: The output of previous time step.
687687
:type out_memory: LayerOutput | None
688-
:param name: lstmemory unit name.
688+
:param name: The lstmemory unit name.
689689
:type name: basestring
690-
:param size: lstmemory unit size.
690+
:param size: The lstmemory unit size.
691691
:type size: int
692-
:param param_attr: parameter attribute, None means default attribute.
692+
:param param_attr: The parameter attribute for the weights in
693+
input to hidden projection.
694+
None means default attribute.
693695
:type param_attr: ParameterAttribute
694-
:param act: last activiation type of lstm.
696+
:param act: The last activiation type of lstm.
695697
:type act: BaseActivation
696-
:param gate_act: gate activiation type of lstm.
698+
:param gate_act: The gate activiation type of lstm.
697699
:type gate_act: BaseActivation
698-
:param state_act: state activiation type of lstm.
700+
:param state_act: The state activiation type of lstm.
699701
:type state_act: BaseActivation
700-
:param input_proj_bias_attr: bias attribute for input to hidden projection.
701-
False means no bias, None means default bias.
702-
:type input_proj_bias_attr: ParameterAttribute|False|None
703-
:param input_proj_layer_attr: extra layer attribute for input to hidden
704-
projection of the LSTM unit, such as dropout, error clipping.
702+
:param input_proj_bias_attr: The parameter attribute for the bias in
703+
input to hidden projection.
704+
False or None means no bias.
705+
If this parameter is set to True,
706+
the bias is initialized to zero.
707+
:type input_proj_bias_attr: ParameterAttribute|bool|None
708+
:param input_proj_layer_attr: The extra layer attribute for
709+
input to hidden projection of the LSTM unit,
710+
such as dropout, error clipping.
705711
:type input_proj_layer_attr: ExtraLayerAttribute
706-
:param lstm_bias_attr: bias parameter attribute of lstm layer.
707-
False means no bias, None means default bias.
708-
:type lstm_bias_attr: ParameterAttribute|False|None
709-
:param lstm_layer_attr: extra attribute of lstm layer.
712+
:param lstm_bias_attr: The parameter attribute for the bias in lstm layer.
713+
False or None means no bias.
714+
If this parameter is set to True,
715+
the bias is initialized to zero.
716+
:type lstm_bias_attr: ParameterAttribute|True|None
717+
:param lstm_layer_attr: The extra attribute of lstm layer.
710718
:type lstm_layer_attr: ExtraLayerAttribute
711-
:return: lstmemory unit name.
719+
:return: The lstmemory unit name.
712720
:rtype: LayerOutput
713721
"""
714722
if size is None:
@@ -786,34 +794,42 @@ def lstmemory_group(input,
786794
gate_act=SigmoidActivation(),
787795
state_act=TanhActivation())
788796
789-
:param input: input layer.
797+
:param input: Input layer.
790798
:type input: LayerOutput
791-
:param size: lstmemory group size.
799+
:param size: The lstmemory group size.
792800
:type size: int
793-
:param name: name of lstmemory group.
801+
:param name: The name of lstmemory group.
794802
:type name: basestring
795-
:param out_memory: output of previous time step.
803+
:param out_memory: The output of previous time step.
796804
:type out_memory: LayerOutput | None
797-
:param reverse: process the input in a reverse order or not.
805+
:param reverse: Process the input in a reverse order or not.
798806
:type reverse: bool
799-
:param param_attr: parameter attribute, None means default attribute.
807+
:param param_attr: The parameter attribute for the weights in
808+
input to hidden projection.
809+
None means default attribute.
800810
:type param_attr: ParameterAttribute
801-
:param act: last activiation type of lstm.
811+
:param act: The last activiation type of lstm.
802812
:type act: BaseActivation
803-
:param gate_act: gate activiation type of lstm.
813+
:param gate_act: The gate activiation type of lstm.
804814
:type gate_act: BaseActivation
805-
:param state_act: state activiation type of lstm.
815+
:param state_act: The state activiation type of lstm.
806816
:type state_act: BaseActivation
807-
:param lstm_bias_attr: bias parameter attribute of lstm layer.
808-
False means no bias, None means default bias.
809-
:type lstm_bias_attr: ParameterAttribute|False|None
810-
:param input_proj_bias_attr: bias attribute for input to hidden projection.
811-
False means no bias, None means default bias.
812-
:type input_proj_bias_attr: ParameterAttribute|False|None
813-
:param input_proj_layer_attr: extra layer attribute for input to hidden
814-
projection of the LSTM unit, such as dropout, error clipping.
817+
:param input_proj_bias_attr: The parameter attribute for the bias in
818+
input to hidden projection.
819+
False or None means no bias.
820+
If this parameter is set to True,
821+
the bias is initialized to zero.
822+
:type input_proj_bias_attr: ParameterAttribute|bool|None
823+
:param input_proj_layer_attr: The extra layer attribute for
824+
input to hidden projection of the LSTM unit,
825+
such as dropout, error clipping.
815826
:type input_proj_layer_attr: ExtraLayerAttribute
816-
:param lstm_layer_attr: lstm layer's extra attribute.
827+
:param lstm_bias_attr: The parameter attribute for the bias in lstm layer.
828+
False or None means no bias.
829+
If this parameter is set to True,
830+
the bias is initialized to zero.
831+
:type lstm_bias_attr: ParameterAttribute|True|None
832+
:param lstm_layer_attr: The extra attribute of lstm layer.
817833
:type lstm_layer_attr: ExtraLayerAttribute
818834
:return: the lstmemory group.
819835
:rtype: LayerOutput

0 commit comments

Comments
 (0)