Skip to content

Commit de2bc5d

Browse files
author
ranqiu
committed
Update annotations of layers.py according to comments
1 parent 1baeebc commit de2bc5d

File tree

1 file changed

+54
-50
lines changed
  • python/paddle/trainer_config_helpers

1 file changed

+54
-50
lines changed

python/paddle/trainer_config_helpers/layers.py

Lines changed: 54 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ def mixed_layer(size=0,
888888
:type size: int
889889
:param input: The input of this layer. It is an optional parameter. If set,
890890
then this function will just return layer's name.
891-
:param act: Activation Type. LinearActivation is the default.
891+
:param act: Activation Type. LinearActivation is the default activation.
892892
:type act: BaseActivation
893893
:param bias_attr: The bias attribute. If the parameter is set to False or an object
894894
whose type is not ParameterAttribute, no bias is defined. If the
@@ -1030,7 +1030,7 @@ def fc_layer(input,
10301030
:type input: LayerOutput | list | tuple
10311031
:param size: The layer dimension.
10321032
:type size: int
1033-
:param act: Activation Type. TanhActivation is the default.
1033+
:param act: Activation Type. TanhActivation is the default activation.
10341034
:type act: BaseActivation
10351035
:param param_attr: The Parameter Attribute|list.
10361036
:type param_attr: ParameterAttribute
@@ -1527,7 +1527,7 @@ def lstmemory(input,
15271527
:type input: LayerOutput
15281528
:param reverse: is sequence process reversed or not.
15291529
:type reverse: bool
1530-
:param act: Activation type. TanhActivation is the default. :math:`h_t`
1530+
:param act: Activation type. TanhActivation is the default activation.
15311531
:type act: BaseActivation
15321532
:param gate_act: gate activation type, SigmoidActivation by default.
15331533
:type gate_act: BaseActivation
@@ -1920,7 +1920,7 @@ def repeat_layer(input,
19201920
False for treating input as column vector and repeating
19211921
in the row direction.
19221922
:type as_row_vector: bool
1923-
:param act: Activation type. IdentityActivation is the default.
1923+
:param act: Activation type. IdentityActivation is the default activation.
19241924
:type act: BaseActivation
19251925
:type name: basestring
19261926
:param layer_attr: extra layer attributes.
@@ -1974,7 +1974,7 @@ def seq_reshape_layer(input,
19741974
:type reshape_size: int
19751975
:param name: The name of this layer. It is optional.
19761976
:type name: basestring
1977-
:param act: Activation type. IdentityActivation is the default.
1977+
:param act: Activation type. IdentityActivation is the default activation.
19781978
:type act: BaseActivation
19791979
:param layer_attr: extra layer attributes.
19801980
:type layer_attr: ExtraLayerAttribute.
@@ -2487,7 +2487,7 @@ def img_conv_layer(input,
24872487
shape will be (filter_size, filter_size_y).
24882488
:type filter_size_y: int | None
24892489
:param num_filters: Each filter group's number of filter
2490-
:param act: Activation type. ReluActivation is the default.
2490+
:param act: Activation type. ReluActivation is the default activation.
24912491
:type act: BaseActivation
24922492
:param groups: Group size of filters.
24932493
:type groups: int
@@ -3253,7 +3253,7 @@ def addto_layer(input, act=None, name=None, bias_attr=None, layer_attr=None):
32533253
:param input: Input layers. It could be a LayerOutput or list/tuple of
32543254
LayerOutput.
32553255
:type input: LayerOutput | list | tuple
3256-
:param act: Activation Type. LinearActivation is the default.
3256+
:param act: Activation Type. LinearActivation is the default activation.
32573257
:type act: BaseActivation
32583258
:param bias_attr: The bias attribute. If the parameter is set to False or an object
32593259
whose type is not ParameterAttribute, no bias is defined. If the
@@ -3311,7 +3311,7 @@ def concat_layer(input, act=None, name=None, layer_attr=None, bias_attr=None):
33113311
:type name: basestring
33123312
:param input: input layers or projections
33133313
:type input: list | tuple | collections.Sequence
3314-
:param act: Activation type. IdentityActivation is the default.
3314+
:param act: Activation type. IdentityActivation is the default activation.
33153315
:type act: BaseActivation
33163316
:param layer_attr: Extra Layer Attribute.
33173317
:type layer_attr: ExtraLayerAttribute
@@ -3406,7 +3406,7 @@ def seq_concat_layer(a, b, act=None, name=None, layer_attr=None,
34063406
:type a: LayerOutput
34073407
:param b: input sequence layer
34083408
:type b: LayerOutput
3409-
:param act: Activation type. IdentityActivation is the default.
3409+
:param act: Activation type. IdentityActivation is the default activation.
34103410
:type act: BaseActivation
34113411
:param layer_attr: Extra Layer Attribute.
34123412
:type layer_attr: ExtraLayerAttribute
@@ -3572,7 +3572,7 @@ def lstm_step_layer(input,
35723572
...
35733573
35743574
3575-
This layer has two outputs. Default output is :math:`h_t`. The other
3575+
This layer has two outputs. The default output is :math:`h_t`. The other
35763576
output is :math:`o_t`, whose name is 'state' and users can use
35773577
:code:`get_output_layer` to extract this output.
35783578
@@ -3583,13 +3583,15 @@ def lstm_step_layer(input,
35833583
:type size: int
35843584
:param input: The input of this layer.
35853585
:type input: LayerOutput
3586-
:param state: The state of a lstm.
3586+
:param state: The state of the LSTM unit.
35873587
:type state: LayerOutput
3588-
:param act: Activation type. TanhActivation is the default.
3588+
:param act: Activation type. TanhActivation is the default activation.
35893589
:type act: BaseActivation
3590-
:param gate_act: Activation type of the gate. SigmoidActivation is the default.
3590+
:param gate_act: Activation type of the gate. SigmoidActivation is the
3591+
default activation.
35913592
:type gate_act: BaseActivation
3592-
:param state_act: Activation type of the state. TanhActivation is the default.
3593+
:param state_act: Activation type of the state. TanhActivation is the
3594+
default activation.
35933595
:type state_act: BaseActivation
35943596
:param bias_attr: The bias attribute. If the parameter is set to False or an object
35953597
whose type is not ParameterAttribute, no bias is defined. If the
@@ -3648,12 +3650,13 @@ def gru_step_layer(input,
36483650
:param size: The dimension of this layer's output. If it is not set or set to None,
36493651
it will be set to one-third of the dimension of the input automatically.
36503652
:type size: int
3651-
:param act: Activation type of this layer's output. SigmoidActivation
3652-
is the default.
3653+
:param act: Activation type of this layer's output. TanhActivation
3654+
is the default activation.
36533655
:type act: BaseActivation
36543656
:param name: The name of this layer. It is optional.
36553657
:type name: basestring
3656-
:param gate_act: Activation type of this layer's two gates. Default is Sigmoid.
3658+
:param gate_act: Activation type of this layer's two gates. SigmoidActivation is
3659+
the default activation.
36573660
:type gate_act: BaseActivation
36583661
:param bias_attr: The bias attribute. If the parameter is set to False or an object
36593662
whose type is not ParameterAttribute, no bias is defined. If the
@@ -3707,10 +3710,10 @@ def gru_step_naive_layer(input,
37073710
param_attr=None,
37083711
layer_attr=None):
37093712
"""
3710-
GRU Step Layer, but using MixedLayer to generate. It supports ERROR_CLIPPING
3713+
GRU Step Layer, which is realized using PaddlePaddle API. It supports ERROR_CLIPPING
37113714
and DROPOUT.
37123715
3713-
:param input: The input of this layer, whose dimension can be divided by 3.
3716+
:param input: The input of this layer, whose dimensionality can be divided by 3.
37143717
:param output_mem: A memory which memorizes the output of this layer at previous
37153718
time step.
37163719
:type output_mem: LayerOutput
@@ -3719,11 +3722,11 @@ def gru_step_naive_layer(input,
37193722
:type size: int
37203723
:param name: The name of this layer. It is optional.
37213724
:type name: basestring
3722-
:param act: Activation type of this layer's output. SigmoidActivation
3723-
is the default.
3725+
:param act: Activation type of this layer's output. TanhActivation
3726+
is the default activation.
37243727
:type act: BaseActivation
3725-
:param gate_act: Activation type of this layer's two gates. TanhActivation
3726-
is the default.
3728+
:param gate_act: Activation type of this layer's two gates. SigmoidActivation
3729+
is the default activation.
37273730
:type gate_act: BaseActivation
37283731
:param bias_attr: The bias attribute. If the parameter is set to False or an object
37293732
whose type is not ParameterAttribute, no bias is defined. If the
@@ -3798,7 +3801,7 @@ def get_output_layer(input, arg_name, name=None, layer_attr=None):
37983801
:param input: The input layer. And this layer should contain
37993802
multiple outputs.
38003803
:type input: LayerOutput
3801-
:param arg_name: The name of the output of the input layer.
3804+
:param arg_name: The name of the output to be extracted from the input layer.
38023805
:type arg_name: basestring
38033806
:param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
38043807
details.
@@ -3858,7 +3861,7 @@ def recurrent_layer(input,
38583861
38593862
:param input: The input of this layer.
38603863
:type input: LayerOutput
3861-
:param act: Activation type. TanhActivation is the default.
3864+
:param act: Activation type. TanhActivation is the default activation.
38623865
:type act: BaseActivation
38633866
:param bias_attr: The bias attribute. If the parameter is set to False or an object
38643867
whose type is not ParameterAttribute, no bias is defined. If the
@@ -3928,8 +3931,8 @@ def recurrent_group(step, input, reverse=False, name=None, targetInlink=None):
39283931
Recurrent layer group is an extremely flexible recurrent unit in
39293932
PaddlePaddle. As long as the user defines the calculation done within a
39303933
time step, PaddlePaddle will iterate such a recurrent calculation over
3931-
sequence input. This is extremely useful for attention-based models, or
3932-
Neural Turning Machine like models.
3934+
sequence input. This is useful for attention-based models, or Neural
3935+
Turning Machine like models.
39333936
39343937
The basic usage (time steps) is:
39353938
@@ -3951,9 +3954,8 @@ def step(input):
39513954
demo/seqToseq/seqToseq_net.py
39523955
- sequence steps: paddle/gserver/tests/sequence_nest_layer_group.conf
39533956
3954-
:param step: A step function which will be executed every step. The input
3955-
of this function is the input of the group. The return of
3956-
this function will be recurrent group's return value.
3957+
:param step: A step function which takes the input of recurrent_group as its own
3958+
input and returns values as recurrent_group's output every time step.
39573959
39583960
The recurrent group scatters a sequence into time steps. And
39593961
for each time step, it will invoke step function, and return
@@ -4251,8 +4253,8 @@ def rnn_step(input):
42514253
- machine translation : demo/seqToseq/translation/gen.conf \
42524254
demo/seqToseq/seqToseq_net.py
42534255
4254-
:param name: The name of the recurrent unit that generates sequences.
4255-
It is optional.
4256+
:param name: The name of the recurrent unit that is responsible for
4257+
generating sequences. It is optional.
42564258
:type name: basestring
42574259
:param step: A callable function that defines the calculation in a time
42584260
step, and it is applied to sequences with arbitrary length by
@@ -4386,7 +4388,7 @@ def square_error_cost(input,
43864388
mini-batch. It is optional.
43874389
:type weight: LayerOutput
43884390
:param coeff: The weight of the gradient in the back propagation.
4389-
1.0 is the default.
4391+
1.0 is the default value.
43904392
:type coeff: float
43914393
:param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
43924394
details.
@@ -4435,7 +4437,7 @@ def classification_cost(input,
44354437
details.
44364438
:type layer_attr: ExtraLayerAttribute
44374439
:param coeff: The weight of the gradient in the back propagation.
4438-
1.0 is the default.
4440+
1.0 is the default value.
44394441
:type coeff: float
44404442
:return: LayerOutput object.
44414443
:rtype: LayerOutput
@@ -4878,7 +4880,7 @@ def tensor_layer(a,
48784880
:type b: LayerOutput
48794881
:param size: The dimension of this layer.
48804882
:type size: int
4881-
:param act: Activation type. LinearActivation is the default.
4883+
:param act: Activation type. LinearActivation is the default activation.
48824884
:type act: BaseActivation
48834885
:param param_attr: The parameter attribute. See ParameterAttribute for
48844886
details.
@@ -4946,7 +4948,7 @@ def selective_fc_layer(input,
49464948
:param size: The dimension of this layer, which should be equal to that of
49474949
the layer 'select'.
49484950
:type size: int
4949-
:param act: Activation type. TanhActivation is the default.
4951+
:param act: Activation type. TanhActivation is the default activation.
49504952
:type act: BaseActivation
49514953
:param pass_generation: The flag which indicates whether it is during generation.
49524954
:type pass_generation: bool
@@ -5498,7 +5500,7 @@ def crf_layer(input,
54985500
:param name: The name of this layer. It is optional.
54995501
:type name: basestring
55005502
:param coeff: The weight of the gradient in the back propagation.
5501-
1.0 is the default.
5503+
1.0 is the default value.
55025504
:type coeff: float
55035505
:param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
55045506
details.
@@ -5644,12 +5646,13 @@ def nce_layer(input,
56445646
:type weight: LayerOutput
56455647
:param num_classes: The number of classes.
56465648
:type num_classes: int
5647-
:param act: Activation type. SigmoidActivation is the default.
5649+
:param act: Activation type. SigmoidActivation is the default activation.
56485650
:type act: BaseActivation
56495651
:param param_attr: The parameter attribute. See ParameterAttribute for
56505652
details.
56515653
:type param_attr: ParameterAttribute
5652-
:param num_neg_samples: The number of sampled negative labels. 10 is the default.
5654+
:param num_neg_samples: The number of sampled negative labels. 10 is the
5655+
default value.
56535656
:type num_neg_samples: int
56545657
:param neg_distribution: The discrete noisy distribution over the output
56555658
space from which num_neg_samples negative labels
@@ -5775,7 +5778,7 @@ def rank_cost(left,
57755778
:param name: The name of this layer. It is optional.
57765779
:type name: basestring
57775780
:param coeff: The weight of the gradient in the back propagation.
5778-
1.0 is the default.
5781+
1.0 is the default value.
57795782
:type coeff: float
57805783
:param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
57815784
details.
@@ -5886,7 +5889,7 @@ def cross_entropy(input,
58865889
:param name: The name of this layer. It is optional.
58875890
:type name: basestring
58885891
:param coeff: The weight of the gradient in the back propagation.
5889-
1.0 is the default.
5892+
1.0 is the default value.
58905893
:type coeff: float
58915894
:param weight: The weight layer defines a weight for each sample in the
58925895
mini-batch. It is optional.
@@ -5934,7 +5937,7 @@ def cross_entropy_with_selfnorm(input,
59345937
:param name: The name of this layer. It is optional.
59355938
:type name: basestring
59365939
:param coeff: The weight of the gradient in the back propagation.
5937-
1.0 is the default.
5940+
1.0 is the default value.
59385941
:type coeff: float
59395942
:param softmax_selfnorm_alpha: The scale factor affects the cost.
59405943
:type softmax_selfnorm_alpha: float
@@ -6024,7 +6027,7 @@ def huber_regression_cost(input,
60246027
:param delta: The difference between the observed and predicted values.
60256028
:type delta: float
60266029
:param coeff: The weight of the gradient in the back propagation.
6027-
1.0 is the default.
6030+
1.0 is the default value.
60286031
:type coeff: float
60296032
:param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
60306033
details.
@@ -6074,7 +6077,7 @@ def huber_classification_cost(input,
60746077
:param name: The name of this layer. It is optional.
60756078
:type name: basestring
60766079
:param coeff: The weight of the gradient in the back propagation.
6077-
1.0 is the default.
6080+
1.0 is the default value.
60786081
:type coeff: float
60796082
:param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
60806083
details.
@@ -6119,7 +6122,7 @@ def multi_binary_label_cross_entropy(input,
61196122
:param name: The name of this layer. It is optional.
61206123
:type name: basestring
61216124
:param coeff: The weight of the gradient in the back propagation.
6122-
1.0 is the default.
6125+
1.0 is the default value.
61236126
:type coeff: float
61246127
:param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
61256128
details.
@@ -6290,7 +6293,7 @@ def smooth_l1_cost(input, label, name=None, coeff=1.0, layer_attr=None):
62906293
:param name: The name of this layer. It is optional.
62916294
:type name: basestring
62926295
:param coeff: The weight of the gradient in the back propagation.
6293-
1.0 is the default.
6296+
1.0 is the default value.
62946297
:type coeff: float
62956298
:param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
62966299
details.
@@ -6442,7 +6445,7 @@ def row_conv_layer(input,
64426445
:param context_len: The context length equals the lookahead step number
64436446
plus one.
64446447
:type context_len: int
6445-
:param act: Activation Type. LinearActivation is the default.
6448+
:param act: Activation Type. LinearActivation is the default activation.
64466449
:type act: BaseActivation
64476450
:param param_attr: The parameter attribute. See ParameterAttribute for
64486451
details.
@@ -6564,7 +6567,8 @@ def gated_unit_layer(input,
65646567
:type input: LayerOutput
65656568
:param size: The dimension of this layer's output.
65666569
:type size: int
6567-
:param act: Activation type of the projection. LinearActivation is the default.
6570+
:param act: Activation type of the projection. LinearActivation is the default
6571+
activation.
65686572
:type act: BaseActivation
65696573
:param name: The name of this layer. It is optional.
65706574
:type name: basestring
@@ -6945,7 +6949,7 @@ def img_conv3d_layer(input,
69456949
:type filter_size: int | tuple | list
69466950
:param num_filters: The number of filters in each group.
69476951
:type num_filters: int
6948-
:param act: Activation type. ReluActivation is the default.
6952+
:param act: Activation type. ReluActivation is the default activation.
69496953
:type act: BaseActivation
69506954
:param groups: The number of the filter groups.
69516955
:type groups: int
@@ -7137,7 +7141,7 @@ def sub_seq_layer(input, offsets, sizes, act=None, bias_attr=None, name=None):
71377141
:type offsets: LayerOutput
71387142
:param sizes: The sizes of the sub-sequences, which should be sequence type.
71397143
:type sizes: LayerOutput
7140-
:param act: Activation type, LinearActivation is the default.
7144+
:param act: Activation type, LinearActivation is the default activation.
71417145
:type act: BaseActivation.
71427146
:param bias_attr: The bias attribute. If the parameter is set to False or an object
71437147
whose type is not ParameterAttribute, no bias is defined. If the

0 commit comments

Comments
 (0)