diff options
author | Gonzalo <456459+grzuy@users.noreply.github.com> | 2023-12-29 20:00:12 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-30 00:00:12 +0100 |
commit | 0a245e6fa46c16f332555a58271dbd49a8058a9c (patch) | |
tree | 0734edfe429befea01dbcac701207cc815269166 /candle-metal-kernels | |
parent | 87d7f81b438db6a1696f2ac79606b40e61d448e8 (diff) | |
download | candle-0a245e6fa46c16f332555a58271dbd49a8058a9c.tar.gz candle-0a245e6fa46c16f332555a58271dbd49a8058a9c.tar.bz2 candle-0a245e6fa46c16f332555a58271dbd49a8058a9c.zip |
Metal: support unary abs (#1503)
* Metal: support unary abs
* cargo fmt
Diffstat (limited to 'candle-metal-kernels')
-rw-r--r-- | candle-metal-kernels/src/lib.rs | 5 | ||||
-rw-r--r-- | candle-metal-kernels/src/unary.metal | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/candle-metal-kernels/src/lib.rs b/candle-metal-kernels/src/lib.rs index d080ef52..5d34f61a 100644 --- a/candle-metal-kernels/src/lib.rs +++ b/candle-metal-kernels/src/lib.rs @@ -173,7 +173,10 @@ macro_rules! ops{ } pub mod unary { - ops!(cos, sin, exp, sqr, sqrt, neg, log, gelu, ceil, floor, round, erf, gelu_erf, tanh, recip); + ops!( + cos, sin, exp, sqr, sqrt, neg, log, gelu, abs, ceil, floor, round, erf, gelu_erf, tanh, + recip + ); } pub mod binary { ops!(add, sub, mul, div, min, max, eq, ne, le, lt, ge, gt); diff --git a/candle-metal-kernels/src/unary.metal b/candle-metal-kernels/src/unary.metal index 15d1e400..7fbb613d 100644 --- a/candle-metal-kernels/src/unary.metal +++ b/candle-metal-kernels/src/unary.metal @@ -102,6 +102,7 @@ UNARY_OP(neg) UNARY_OP(exp) UNARY_OP(log) UNARY_OP(gelu) +UNARY_OP(abs) UNARY_OP(ceil) UNARY_OP(floor) UNARY_OP(round) |