Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
revert gelu
Browse files Browse the repository at this point in the history
  • Loading branch information
zheyuye committed Jul 30, 2020
1 parent 0425346 commit 9a7c343
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/gluonnlp/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def __init__(self, mode='erf'):

def hybrid_forward(self, F, x):
if self._mode == 'erf':
return F.npx.leaky_relu(x, act_type='gelu')
return x * 0.5 * (1.0 + F.npx.erf(x / math.sqrt(2.0)))
elif self._mode == 'tanh':
return 0.5 * x\
* (1.0 + F.np.tanh(math.sqrt(2.0 / math.pi) * (x + 0.044715 * (x ** 3))))
Expand Down

0 comments on commit 9a7c343

Please sign in to comment.