[][src]Trait neuro::layers::Layer

pub trait Layer: Display {
    fn name(&self) -> &str;
fn initialize_parameters(&mut self, input_shape: Dim4);
fn compute_activation(&self, input: &Tensor) -> Tensor;
fn compute_activation_mut(&mut self, input: &Tensor) -> Tensor;
fn compute_dactivation_mut(&mut self, input: &Tensor) -> Tensor;
fn output_shape(&self) -> Dim;
fn save(&self, group: &Group, layer_number: usize) -> Result<(), Error>; fn parameters(&self) -> Option<Vec<&Tensor>> { ... }
fn parameters_mut(&mut self) -> Option<(Vec<&mut Tensor>, Vec<&Tensor>)> { ... }
fn set_regularizer(&mut self, _regularizer: Option<Regularizer>) { ... }
fn print(&self) { ... } }

Public trait defining the behaviors of a layer.

Required methods

fn name(&self) -> &str

Returns the name of the layer.

fn initialize_parameters(&mut self, input_shape: Dim4)

Initializes the parameters of the layer.

fn compute_activation(&self, input: &Tensor) -> Tensor

Computes the activation of the layer during the forward pass.

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

Computes the forward pass and stores intermediate values for efficient backpropagation.

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

Computes the backward pass through the layer.

fn output_shape(&self) -> Dim

Returns the shape of the output.

fn save(&self, group: &Group, layer_number: usize) -> Result<(), Error>

Writes the parameters of the layer in the HDF5 group.

Arguments

  • group: The HDF5 group where the layer will be saved.
  • layer_number: The position of the layer in the network.
Loading content...

Provided methods

fn parameters(&self) -> Option<Vec<&Tensor>>

Returns the trainable parameters of the layer.

fn parameters_mut(&mut self) -> Option<(Vec<&mut Tensor>, Vec<&Tensor>)>

Returns the trainable parameters of the layer and their derivatives.

fn set_regularizer(&mut self, _regularizer: Option<Regularizer>)

Sets the regularizer for the layer.

fn print(&self)

Displays the properties of the layer.

Loading content...

Implementors

impl Layer for BatchNorm[src]

impl Layer for Conv2D[src]

impl Layer for Dense[src]

impl Layer for Dropout[src]

impl Layer for Flatten[src]

impl Layer for MaxPool2D[src]

Loading content...