Skip to content

Commit fded6ea

Browse files
authored
Merge pull request #13965 from guoshengCS/cherry-pick-gru-doc
cherry-pick: Refine the doc of dynamic_gru and gru_unit.
2 parents 15f39b7 + 2bd42a2 commit fded6ea

File tree

1 file changed

+34
-5
lines changed
  • python/paddle/fluid/layers

1 file changed

+34
-5
lines changed

python/paddle/fluid/layers/nn.py

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,18 @@ def dynamic_gru(input,
701701
The first part are weights of the update gate and reset gate with
702702
shape :math:`(D \\times 2D)`, and the second part are weights for
703703
candidate hidden state with shape :math:`(D \\times D)`.
704-
bias_attr(ParamAttr): The parameter attribute for learnable the
705-
hidden-hidden bias.
704+
705+
If it is set to None or one attribute of ParamAttr, dynamic_gru will
706+
create ParamAttr as param_attr. If the Initializer of the param_attr
707+
is not set, the parameter is initialized with Xavier. Default: None.
708+
bias_attr (ParamAttr|bool|None): The parameter attribute for the bias
709+
of GRU. Note that the bias with :math:`(1 \\times 3D)` concatenates
710+
the bias in the update gate, reset gate and candidate calculations.
711+
If it is set to False, no bias will be applied to the update gate,
712+
reset gate and candidate calculations. If it is set to None or one
713+
attribute of ParamAttr, dynamic_gru will create ParamAttr as
714+
bias_attr. If the Initializer of the bias_attr is not set, the bias
715+
is initialized zero. Default: None.
706716
is_reverse(bool): Whether to compute reversed GRU, default
707717
:attr:`False`.
708718
gate_activation(str): The activation for update gate and reset gate.
@@ -801,10 +811,29 @@ def gru_unit(input,
801811
802812
Args:
803813
input (Variable): The fc transformed input value of current step.
804-
hidden (Variable): The hidden value of lstm unit from previous step.
814+
hidden (Variable): The hidden value of gru unit from previous step.
805815
size (integer): The input dimension value.
806-
param_attr (ParamAttr): The weight parameters for gru unit. Default: None
807-
bias_attr (ParamAttr): The bias parameters for gru unit. Default: None
816+
param_attr(ParamAttr|None): The parameter attribute for the learnable
817+
hidden-hidden weight matrix. Note:
818+
819+
- The shape of the weight matrix is :math:`(T \\times 3D)`, where
820+
:math:`D` is the hidden size.
821+
- All elements in the weight matrix can be divided into two parts.
822+
The first part are weights of the update gate and reset gate with
823+
shape :math:`(D \\times 2D)`, and the second part are weights for
824+
candidate hidden state with shape :math:`(D \\times D)`.
825+
826+
If it is set to None or one attribute of ParamAttr, gru_unit will
827+
create ParamAttr as param_attr. If the Initializer of the param_attr
828+
is not set, the parameter is initialized with Xavier. Default: None.
829+
bias_attr (ParamAttr|bool|None): The parameter attribute for the bias
830+
of GRU. Note that the bias with :math:`(1 \\times 3D)` concatenates
831+
the bias in the update gate, reset gate and candidate calculations.
832+
If it is set to False, no bias will be applied to the update gate,
833+
reset gate and candidate calculations. If it is set to None or one
834+
attribute of ParamAttr, gru_unit will create ParamAttr as
835+
bias_attr. If the Initializer of the bias_attr is not set, the bias
836+
is initialized zero. Default: None.
808837
activation (string): The activation type for cell (actNode).
809838
Default: 'tanh'
810839
gate_activation (string): The activation type for gates (actGate).

0 commit comments

Comments
 (0)