aboutsummaryrefslogtreecommitdiff
path: root/libffwd/act.c
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-09-29 13:11:00 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-09-29 13:11:00 +0200
commit37cbaef9ceb828c667da8f398027ba5415ee7475 (patch)
tree6103e92a9030766e78a35df00f7a1155d0d0ecf5 /libffwd/act.c
parentcf7d8169ec12cb3adf90d4ff78b3257e74985302 (diff)
downloadlangdet-37cbaef9ceb828c667da8f398027ba5415ee7475.tar.gz
langdet-37cbaef9ceb828c667da8f398027ba5415ee7475.zip
Rename CPU library API and sources to langdet
Diffstat (limited to 'libffwd/act.c')
-rw-r--r--libffwd/act.c29
1 files changed, 0 insertions, 29 deletions
diff --git a/libffwd/act.c b/libffwd/act.c
deleted file mode 100644
index 3912f2f..0000000
--- a/libffwd/act.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "kernels.h"
-
-#include <math.h>
-
-void gelu_inplace(float *x, int n) {
- /* Exact erf GeLU; 0.70710678... = 1/sqrt(2). */
- for (int i = 0; i < n; i++)
- x[i] = 0.5f * x[i] * (1.0f + erff(x[i] * 0.70710678118654752f));
-}
-
-void softmax(float *x, int rows, int cols) {
- for (int r = 0; r < rows; r++) {
- float *row = x + r * cols;
- float max_val = row[0];
- for (int c = 1; c < cols; c++) {
- if (row[c] > max_val)
- max_val = row[c];
- }
- float sum = 0.0f;
- for (int c = 0; c < cols; c++) {
- row[c] = expf(row[c] - max_val);
- sum += row[c];
- }
- float inv_sum = 1.0f / sum;
- for (int c = 0; c < cols; c++) {
- row[c] *= inv_sum;
- }
- }
-}