Add support for the marian base model. (#1221)

This commit is contained in:
Laurent Mazare
2023-10-30 20:20:36 +01:00
committed by GitHub
parent 4c967b9184
commit 392a00a147
3 changed files with 72 additions and 11 deletions

View File

@ -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),
}