metal : add GGML_UNARY_OP_ELU kernel (ggml/1018)
This commit is contained in:
parent
342397dc7e
commit
12b0ad953a
2 changed files with 23 additions and 0 deletions
|
|
@ -782,6 +782,14 @@ kernel void kernel_silu_4(
|
|||
dst[tpig] = x / (1.0f + exp(-x));
|
||||
}
|
||||
|
||||
kernel void kernel_elu(
|
||||
device const float * src0,
|
||||
device float * dst,
|
||||
uint tpig[[thread_position_in_grid]]) {
|
||||
device const float & x = src0[tpig];
|
||||
dst[tpig] = (x > 0.0f) ? x : (exp(x) - 1.0f);
|
||||
}
|
||||
|
||||
kernel void kernel_sqr(
|
||||
device const float * src0,
|
||||
device float * dst,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue