Skip to content

Commit 2bd42a2

Browse files
committed
cherry-pick:Refine the doc of dynamic_gru and gru_unit. test=release/1.0.0
1 parent 3cb8da9 commit 2bd42a2

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
@@ -681,8 +681,18 @@ def dynamic_gru(input,
681681
The first part are weights of the update gate and reset gate with
682682
shape :math:`(D \\times 2D)`, and the second part are weights for
683683
candidate hidden state with shape :math:`(D \\times D)`.
684-
bias_attr(ParamAttr): The parameter attribute for learnable the
685-
hidden-hidden bias.
684+
685+
If it is set to None or one attribute of ParamAttr, dynamic_gru will
686+
create ParamAttr as param_attr. If the Initializer of the param_attr
687+
is not set, the parameter is initialized with Xavier. Default: None.
688+
bias_attr (ParamAttr|bool|None): The parameter attribute for the bias
689+
of GRU. Note that the bias with :math:`(1 \\times 3D)` concatenates
690+
the bias in the update gate, reset gate and candidate calculations.
691+
If it is set to False, no bias will be applied to the update gate,
692+
reset gate and candidate calculations. If it is set to None or one
693+
attribute of ParamAttr, dynamic_gru will create ParamAttr as
694+
bias_attr. If the Initializer of the bias_attr is not set, the bias
695+
is initialized zero. Default: None.
686696
is_reverse(bool): Whether to compute reversed GRU, default
687697
:attr:`False`.
688698
gate_activation(str): The activation for update gate and reset gate.
@@ -781,10 +791,29 @@ def gru_unit(input,
781791
782792
Args:
783793
input (Variable): The fc transformed input value of current step.
784-
hidden (Variable): The hidden value of lstm unit from previous step.
794+
hidden (Variable): The hidden value of gru unit from previous step.
785795
size (integer): The input dimension value.
786-
param_attr (ParamAttr): The weight parameters for gru unit. Default: None
787-
bias_attr (ParamAttr): The bias parameters for gru unit. Default: None
796+
param_attr(ParamAttr|None): The parameter attribute for the learnable
797+
hidden-hidden weight matrix. Note:
798+
799+
- The shape of the weight matrix is :math:`(T \\times 3D)`, where
800+
:math:`D` is the hidden size.
801+
- All elements in the weight matrix can be divided into two parts.
802+
The first part are weights of the update gate and reset gate with
803+
shape :math:`(D \\times 2D)`, and the second part are weights for
804+
candidate hidden state with shape :math:`(D \\times D)`.
805+
806+
If it is set to None or one attribute of ParamAttr, gru_unit will
807+
create ParamAttr as param_attr. If the Initializer of the param_attr
808+
is not set, the parameter is initialized with Xavier. Default: None.
809+
bias_attr (ParamAttr|bool|None): The parameter attribute for the bias
810+
of GRU. Note that the bias with :math:`(1 \\times 3D)` concatenates
811+
the bias in the update gate, reset gate and candidate calculations.
812+
If it is set to False, no bias will be applied to the update gate,
813+
reset gate and candidate calculations. If it is set to None or one
814+
attribute of ParamAttr, gru_unit will create ParamAttr as
815+
bias_attr. If the Initializer of the bias_attr is not set, the bias
816+
is initialized zero. Default: None.
788817
activation (string): The activation type for cell (actNode).
789818
Default: 'tanh'
790819
gate_activation (string): The activation type for gates (actGate).

0 commit comments

Comments
 (0)