def gelu.f

bend-ml-tensor@0.1.2.0 · main.bend:354

import bend-ml-tensor@0.1.2.0/main.bend as BendMlTensor
import Base

354# GELU with the tanh approximation (the same as GPT-2)
355def gelu.f(+x: F32) -> F32:
356  (0.5 * (x * (1.0 + F32.tanh((0.7978846 * (x + (0.044715 * (x * (x * x : F32) : F32) : F32) : F32) : F32)) : F32) : F32) : F32)

Uses (4)

Used by (1)