20af58f254e0eb72d7938de063ff0909139b4ba7,src/gluonnlp/layers.py,GELU,hybrid_forward,#GELU#Any#Any#,357
Before Change
def hybrid_forward(self, F, x):
if self._mode == "erf":
// TODO Investigate the precision of 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))))
elif self._mode == "sigmoid":
After Change
def hybrid_forward(self, F, x):
if self._mode == "erf":
return F.npx.leaky_relu(x, act_type="gelu")
elif self._mode == "tanh":
return 0.5 * x\
* (1.0 + F.np.tanh(math.sqrt(2.0 / math.pi) * (x + 0.044715 * (x ** 3))))
elif self._mode == "sigmoid":
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: dmlc/gluon-nlp
Commit Name: 20af58f254e0eb72d7938de063ff0909139b4ba7
Time: 2020-08-05
Author: 37728728+ZheyuYe@users.noreply.github.com
File Name: src/gluonnlp/layers.py
Class Name: GELU
Method Name: hybrid_forward
Project Name: dmlc/gluon-nlp
Commit Name: 3c874575bf40e8b1fa2280371131a8f29ebb3e98
Time: 2020-07-28
Author: xshiab@connect.ust.hk
File Name: src/gluonnlp/layers.py
Class Name: GELU
Method Name: hybrid_forward
Project Name: dmlc/gluon-nlp
Commit Name: 8272cef2585f113af24dc45f3b1243a9622f1bec
Time: 2020-01-03
Author: tao.a.lv@intel.com
File Name: src/gluonnlp/model/block.py
Class Name: GELU
Method Name: hybrid_forward