From c20279050f88d9c24187c3e402912596e1f54587 Mon Sep 17 00:00:00 2001 From: Onur Gündüz Date: Tue, 16 Jun 2026 09:26:20 +0200 Subject: all: support BERT tanh-GeLU (gelu_new / gelu_pytorch_tanh) --- qwen_kernels.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qwen_kernels.h') diff --git a/qwen_kernels.h b/qwen_kernels.h index 36d2913..9abb489 100644 --- a/qwen_kernels.h +++ b/qwen_kernels.h @@ -111,6 +111,10 @@ void qwen_silu_mul_inplace(float *gate, const float *up, int n); * "gelu" activation HF BERT/BGE/MiniLM use, not the tanh approximation. */ void qwen_gelu_inplace(float *x, int n); +/* Tanh-approximation GeLU in place (HF gelu_new / gelu_pytorch_tanh): + * x = 0.5 * x * (1 + tanh(sqrt(2/pi) * (x + 0.044715 * x^3))). */ +void qwen_gelu_tanh_inplace(float *x, int n); + /* ======================================================================== * Attention Operations * ======================================================================== */ -- cgit v1.3.1