Skip to main content

gelu_forward

Function gelu_forward 

Source
pub fn gelu_forward<T: Triton, D: Float, const BLOCK_SIZE: i32>(
    x_ptr: T::Pointer<D>,
    y_ptr: T::Pointer<D>,
    n_elements: i32,
)
where T::I32Tensor: Tensor<i32, 1> + Comparison<i32, BoolTensor = T::BoolTensor>, T::Pointer<D>: AddOffsets<i32, 1, T::I32Tensor, Output = T::Tensor<T::Pointer<D>>>,
Expand description

Forward: y = x / (1 + exp(-2 * c * (x + a*x³))) where c = sqrt(2/pi), a = 0.044715 — the tanh GELU approximation.