mirror of
https://github.com/huggingface/candle.git
synced 2025-06-20 04:00:28 +00:00
19 lines
381 B
Rust
19 lines
381 B
Rust
use candle::Tensor;
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
|
pub enum Activation {
|
|
Gelu,
|
|
Relu,
|
|
Elu(f64),
|
|
}
|
|
|
|
impl super::Module for Activation {
|
|
fn forward(&self, xs: &Tensor) -> candle::Result<Tensor> {
|
|
match self {
|
|
Self::Gelu => xs.gelu(),
|
|
Self::Relu => xs.relu(),
|
|
&Self::Elu(alpha) => xs.elu(alpha),
|
|
}
|
|
}
|
|
}
|