summaryrefslogtreecommitdiff
path: root/candle-metal-kernels
diff options
context:
space:
mode:
authorGonzalo <456459+grzuy@users.noreply.github.com>2023-12-29 20:00:12 -0300
committerGitHub <noreply@github.com>2023-12-30 00:00:12 +0100
commit0a245e6fa46c16f332555a58271dbd49a8058a9c (patch)
tree0734edfe429befea01dbcac701207cc815269166 /candle-metal-kernels
parent87d7f81b438db6a1696f2ac79606b40e61d448e8 (diff)
downloadcandle-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.rs5
-rw-r--r--candle-metal-kernels/src/unary.metal1
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)