def gelu(x):return 0.5*x*(1+np.tanh(np.sqrt(2/np.pi)*(x+0.044715*np.power(x, 3))))
| 37 | |
| 38 | //def gelu(x):return 0.5*x*(1+np.tanh(np.sqrt(2/np.pi)*(x+0.044715*np.power(x, 3)))) |
| 39 | float 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 | |
| 43 | const float rsqrt_lut[256] = { |
| 44 | 0.496319f, 0.162070f, 0.117783f, 0.097085f, 0.084483f, 0.075784f, 0.069316f, 0.064264f, |