File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -106,9 +106,10 @@ def sequence_conv_pool(input,
106
106
107
107
def glu (input , dim = - 1 ):
108
108
"""
109
- The gated linear unit composed by split and elementwise multiplication.
110
- Specifically, Split the input into two equal sized parts :math:`a` and
111
- :math:`b` along the given dimension and then compute as following:
109
+ The gated linear unit composed by split, sigmoid activation and elementwise
110
+ multiplication. Specifically, Split the input into two equal sized parts
111
+ :math:`a` and :math:`b` along the given dimension and then compute as
112
+ following:
112
113
113
114
.. math::
114
115
@@ -133,5 +134,6 @@ def glu(input, dim=-1):
133
134
"""
134
135
135
136
a , b = layers .split (input , num_or_sections = 2 , dim = dim )
136
- out = layers .elementwise_mul (x = a , y = b )
137
+ act_b = layers .sigmoid (x = b )
138
+ out = layers .elementwise_mul (x = a , y = act_b )
137
139
return out
You can’t perform that action at this time.
0 commit comments