Skip to content

Commit ffdfd1d

Browse files
committed
Coherence!
1 parent 8c762a3 commit ffdfd1d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ggml/src/ggml.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2648,6 +2648,11 @@ struct ggml_tensor * ggml_silu(
26482648
}
26492649

26502650
// ggml_xielu
2651+
static float softplus(float input) {
2652+
if (input > 20.0f) return input;
2653+
return logf(1 + expf(input));
2654+
}
2655+
26512656
struct ggml_tensor * ggml_xielu(
26522657
struct ggml_context * ctx,
26532658
struct ggml_tensor * a,
@@ -2658,7 +2663,7 @@ struct ggml_tensor * ggml_xielu(
26582663
struct ggml_tensor * result = ggml_dup_tensor(ctx, a);
26592664

26602665
// Store the parameters as operation parameters
2661-
float params[] = { alpha_n, alpha_p, beta, eps };
2666+
float params[] = { beta + softplus(alpha_n), softplus(alpha_p), beta, eps };
26622667
ggml_set_op_params(result, params, sizeof(params));
26632668

26642669
result->op = GGML_OP_XIELU;

0 commit comments

Comments
 (0)