You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/03/16 05:43:53 UTC

[GitHub] [incubator-mxnet] haojin2 commented on a change in pull request #14449: GELU Operator

haojin2 commented on a change in pull request #14449: GELU Operator
URL: https://github.com/apache/incubator-mxnet/pull/14449#discussion_r266190150
 
 

 ##########
 File path: tests/python/unittest/test_operator.py
 ##########
 @@ -862,6 +862,39 @@ def fselu_grad(grad, x, y):
         check_symbolic_backward(y, [xa], [np.ones(shape)], [ga], rtol=rtol, atol=atol, dtype=dtype)
 
 
+@with_seed()
+def test_gelu():
+    CUBE_CONSTANT = 0.044715
+    TWO_OVER_PI = 0.7978845608028654
+    def g(x):
+        return TWO_OVER_PI * (x + CUBE_CONSTANT * np.power(x, 3))
 
 Review comment:
   This is not the actual implementation so performance is not critical here... I'll change the internal mshadow math kernel in C++ based on the link you provided.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services