[−][src]Trait neuro::layers::Layer
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.
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.