MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _npGelu

Method _npGelu

tensorflow/python/kernel_tests/gelu_op_test.py:33–39  ·  view source on GitHub ↗
(self, x, approximate=False)

Source from the content-addressed store, hash-verified

31class GeluTest(test.TestCase):
32
33 def _npGelu(self, x, approximate=False):
34 if approximate:
35 return 0.5 * x * (1.0 + np.tanh(np.sqrt(2.0 / np.pi) *
36 (x + 0.044715 * np.power(x, 3))))
37 else:
38 from scipy.stats import norm # pylint: disable=g-import-not-at-top
39 return x * norm.cdf(x)
40
41 def _testGelu(self, np_features, approximate=False, use_gpu=False):
42 expected_values = self._npGelu(np_features, approximate)

Callers 1

_testGeluMethod · 0.95

Calls 2

powerMethod · 0.80
cdfMethod · 0.45

Tested by

no test coverage detected