Trait Layer

Source
pub trait Layer {
    // Required methods
    fn forward(&self, tape: &GradTape, input: &Matrix<Var>) -> Matrix<Var>;
    fn get_activation(&self) -> Activation;
    fn get_input_shape(&self) -> Vec<usize>;
    fn get_output_shape(&self) -> Vec<usize>;
    fn adjust(&mut self, grad: &Grad, learning_rate: f64);
    fn parameters(&mut self) -> Vec<&mut Var>;
}
Expand description

§Layer

A trait that all layers must implement

Required Methods§

Source

fn forward(&self, tape: &GradTape, input: &Matrix<Var>) -> Matrix<Var>

§Forward

Performs a forward pass on the layer

Source

fn get_activation(&self) -> Activation

§Get Activation

Returns the activation function of the layer

Source

fn get_input_shape(&self) -> Vec<usize>

§Get Input Shape

Returns the input shape of the layer

Source

fn get_output_shape(&self) -> Vec<usize>

§Get Output Shape

Returns the output shape of the layer

Source

fn adjust(&mut self, grad: &Grad, learning_rate: f64)

Source

fn parameters(&mut self) -> Vec<&mut Var>

§Get Parameters

Implementors§