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§
Sourcefn forward(&self, tape: &GradTape, input: &Matrix<Var>) -> Matrix<Var>
fn forward(&self, tape: &GradTape, input: &Matrix<Var>) -> Matrix<Var>
§Forward
Performs a forward pass on the layer
Sourcefn get_activation(&self) -> Activation
fn get_activation(&self) -> Activation
§Get Activation
Returns the activation function of the layer
Sourcefn get_input_shape(&self) -> Vec<usize>
fn get_input_shape(&self) -> Vec<usize>
§Get Input Shape
Returns the input shape of the layer
Sourcefn get_output_shape(&self) -> Vec<usize>
fn get_output_shape(&self) -> Vec<usize>
§Get Output Shape
Returns the output shape of the layer