ruda-nn 0.21.38

Ruda neural network layers, activation modules and losses.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use ruda_model::{module::Module,tensor::{Tensor,backend::Backend}};

/// Stateless SiLU activation with native backend autodiff.
#[derive(Module,Clone,Debug,Default)]
pub struct Silu;

impl Silu {
    /// Construct the activation without parameters or a device allocation.
    pub fn new() -> Self { Self }

    /// Apply x*sigmoid(x), retaining input geometry and backend storage.
    pub fn forward<B: Backend,const D: usize>(&self,input: Tensor<B,D>) -> Tensor<B,D> {
        ruda_model::tensor::activation::silu(input)
    }
}