File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff 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+
26512656struct 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 ;
You can’t perform that action at this time.
0 commit comments