Trait engram::nn::Layer

source ·
pub trait Layer: Debug {
    // Required methods
    fn weights(&self) -> &Tensor;
    fn biases(&self) -> &Tensor;
    fn forward(&mut self, input: &Tensor) -> Tensor;
    fn backward(&mut self, target: &Tensor, loss_fn: &Loss) -> f64;
    fn update_parameters(&mut self, optimizer: &mut dyn Optimizer);
    fn regularization_loss(&self, reg: &dyn Regularization) -> f64;
    fn apply_regularization(&mut self, reg: &dyn Regularization);
    fn eval(&mut self);
    fn train(&mut self);
}

Required Methods§

source

fn weights(&self) -> &Tensor

source

fn biases(&self) -> &Tensor

source

fn forward(&mut self, input: &Tensor) -> Tensor

source

fn backward(&mut self, target: &Tensor, loss_fn: &Loss) -> f64

source

fn update_parameters(&mut self, optimizer: &mut dyn Optimizer)

source

fn regularization_loss(&self, reg: &dyn Regularization) -> f64

source

fn apply_regularization(&mut self, reg: &dyn Regularization)

source

fn eval(&mut self)

source

fn train(&mut self)

Implementors§