summaryrefslogtreecommitdiff
path: root/candle-nn/src
diff options
context:
space:
mode:
authorLaurent Mazare <laurent.mazare@gmail.com>2023-10-30 20:20:36 +0100
committerGitHub <noreply@github.com>2023-10-30 19:20:36 +0000
commit392a00a147c26ebe70c6484d72223d02ada6a72a (patch)
tree653d9d4c29f5738f598fb96329db9031561d7057 /candle-nn/src
parent4c967b9184834cd1e166dfdd6d88450d16bad8f2 (diff)
downloadcandle-392a00a147c26ebe70c6484d72223d02ada6a72a.tar.gz
candle-392a00a147c26ebe70c6484d72223d02ada6a72a.tar.bz2
candle-392a00a147c26ebe70c6484d72223d02ada6a72a.zip
Add support for the marian base model. (#1221)
Diffstat (limited to 'candle-nn/src')
-rw-r--r--candle-nn/src/activation.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/candle-nn/src/activation.rs b/candle-nn/src/activation.rs
index 52ceba78..79cf9c82 100644
--- a/candle-nn/src/activation.rs
+++ b/candle-nn/src/activation.rs
@@ -13,6 +13,7 @@ pub enum Activation {
Relu6,
Silu,
Sigmoid,
+ Swish,
Elu(f64),
LeakyRelu(f64),
}
@@ -28,6 +29,7 @@ impl super::Module for Activation {
Self::Relu6 => xs.clamp(0f32, 6f32),
Self::Silu => crate::ops::silu(xs),
Self::Sigmoid => crate::ops::sigmoid(xs),
+ Self::Swish => xs * crate::ops::sigmoid(xs)?,
&Self::Elu(alpha) => xs.elu(alpha),
&Self::LeakyRelu(negative_slope) => crate::ops::leaky_relu(xs, negative_slope),
}