summaryrefslogtreecommitdiff
path: root/candle-core/src/backprop.rs
diff options
context:
space:
mode:
authorLaurent Mazare <laurent.mazare@gmail.com>2023-09-19 19:54:28 +0100
committerGitHub <noreply@github.com>2023-09-19 19:54:28 +0100
commitd7e48234d4d94653894a33f7a6da31b0a740b060 (patch)
treecfd05359d91eb5eb43acf0ea4e5f746254c546a9 /candle-core/src/backprop.rs
parent34f2ecbc3bc0ae8ba0666808db7de19fb3d907d4 (diff)
downloadcandle-d7e48234d4d94653894a33f7a6da31b0a740b060.tar.gz
candle-d7e48234d4d94653894a33f7a6da31b0a740b060.tar.bz2
candle-d7e48234d4d94653894a33f7a6da31b0a740b060.zip
Add an erf based gelu op (#900)
* Erf based gelu. * Add the erf backed gelu. * Test the new gelu op (which is not gelu_new).
Diffstat (limited to 'candle-core/src/backprop.rs')
-rw-r--r--candle-core/src/backprop.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/candle-core/src/backprop.rs b/candle-core/src/backprop.rs
index 9c8f685f..3e2ae1ed 100644
--- a/candle-core/src/backprop.rs
+++ b/candle-core/src/backprop.rs
@@ -442,6 +442,9 @@ impl Tensor {
*sum_grad = sum_grad.add(&arg_grad)?
}
Op::Unary(_, UnaryOp::Gelu) => Err(Error::BackwardNotSupported { op: "gelu" })?,
+ Op::Unary(_, UnaryOp::GeluErf) => {
+ Err(Error::BackwardNotSupported { op: "gelu-erf" })?
+ }
Op::Unary(arg, UnaryOp::Relu) => {
let sum_grad = grads.or_insert(arg)?;
let relu_grad = arg.ge(&arg.zeros_like()?)?.to_dtype(arg.dtype())?;