MCPcopy Create free account
hub / github.com/Derious/cuMPC / GeLU

Function GeLU

test/test_CORE/test_lut.cpp:39–41  ·  view source on GitHub ↗

def gelu(x):return 0.5*x*(1+np.tanh(np.sqrt(2/np.pi)*(x+0.044715*np.power(x, 3))))

Source from the content-addressed store, hash-verified

37
38//def gelu(x):return 0.5*x*(1+np.tanh(np.sqrt(2/np.pi)*(x+0.044715*np.power(x, 3))))
39float GeLU(float x) {
40 return 0.5 * x * (1 + std::tanh(std::sqrt(2/M_PI)*(x+0.044715*std::pow(x, 3))));
41}
42
43const float rsqrt_lut[256] = {
44 0.496319f, 0.162070f, 0.117783f, 0.097085f, 0.084483f, 0.075784f, 0.069316f, 0.064264f,

Callers

nothing calls this directly

Calls 3

tanhFunction · 0.50
sqrtFunction · 0.50
powFunction · 0.50

Tested by

no test coverage detected