mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-11-03 09:22:01 +00:00 
			
		
		
		
	ggml : add ggml_gelu_erf() (#13667)
* ggml : add ggml_gelu_na (not approximated) * fix naming order * rename na --> erf * apply review suggesions * revert naming order
This commit is contained in:
		@@ -528,14 +528,15 @@ extern "C" {
 | 
			
		||||
        GGML_UNARY_OP_STEP,
 | 
			
		||||
        GGML_UNARY_OP_TANH,
 | 
			
		||||
        GGML_UNARY_OP_ELU,
 | 
			
		||||
        GGML_UNARY_OP_RELU,
 | 
			
		||||
        GGML_UNARY_OP_SIGMOID,
 | 
			
		||||
        GGML_UNARY_OP_GELU,
 | 
			
		||||
        GGML_UNARY_OP_GELU_ERF,
 | 
			
		||||
        GGML_UNARY_OP_GELU_QUICK,
 | 
			
		||||
        GGML_UNARY_OP_SILU,
 | 
			
		||||
        GGML_UNARY_OP_HARDSWISH,
 | 
			
		||||
        GGML_UNARY_OP_HARDSIGMOID,
 | 
			
		||||
        GGML_UNARY_OP_EXP,
 | 
			
		||||
        GGML_UNARY_OP_RELU,
 | 
			
		||||
 | 
			
		||||
        GGML_UNARY_OP_COUNT,
 | 
			
		||||
    };
 | 
			
		||||
@@ -1024,6 +1025,16 @@ extern "C" {
 | 
			
		||||
            struct ggml_context * ctx,
 | 
			
		||||
            struct ggml_tensor  * a);
 | 
			
		||||
 | 
			
		||||
    // GELU using erf (error function) when possible
 | 
			
		||||
    // some backends may fallback to approximation based on Abramowitz and Stegun formula
 | 
			
		||||
    GGML_API struct ggml_tensor * ggml_gelu_erf(
 | 
			
		||||
            struct ggml_context * ctx,
 | 
			
		||||
            struct ggml_tensor  * a);
 | 
			
		||||
 | 
			
		||||
    GGML_API struct ggml_tensor * ggml_gelu_erf_inplace(
 | 
			
		||||
            struct ggml_context * ctx,
 | 
			
		||||
            struct ggml_tensor  * a);
 | 
			
		||||
 | 
			
		||||
    GGML_API struct ggml_tensor * ggml_gelu_quick(
 | 
			
		||||
            struct ggml_context * ctx,
 | 
			
		||||
            struct ggml_tensor  * a);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user