Trait LayerExt

Source
pub trait LayerExt<S, D>: Layer<S, D>
where D: Dimension, S: RawData<Elem = Self::Elem>,
{ // Provided methods fn set_params(&mut self, params: ParamsBase<S, D>) { ... } fn backward<X, Y, Z, Dt>( &mut self, input: X, error: Y, gamma: Self::Elem, ) -> Result<Z> where S: Data, Self: ActivatorGradient<X, Input = Y, Output = Z, Delta = Dt>, Self::Elem: Clone, ParamsBase<S, D>: Backward<X, Dt, Elem = Self::Elem, Output = Z> { ... } fn forward<X, Y>(&self, input: &X) -> Result<Y> where Y: NdTensor<S::Elem, D, Repr = S>, ParamsBase<S, D>: Forward<X, Output = Y>, Self: Activator<Y, Output = Y> { ... } }
Expand description

The LayerExt trait extends the base Layer trait with additional methods that are commonly used in neural network layers. It provides methods for setting parameters, performing backward propagation of errors, and completing a forward pass through the layer.

Provided Methods§

Source

fn set_params(&mut self, params: ParamsBase<S, D>)

update the layer parameters

Source

fn backward<X, Y, Z, Dt>( &mut self, input: X, error: Y, gamma: Self::Elem, ) -> Result<Z>
where S: Data, Self: ActivatorGradient<X, Input = Y, Output = Z, Delta = Dt>, Self::Elem: Clone, ParamsBase<S, D>: Backward<X, Dt, Elem = Self::Elem, Output = Z>,

backward propagate error through the layer

Source

fn forward<X, Y>(&self, input: &X) -> Result<Y>
where Y: NdTensor<S::Elem, D, Repr = S>, ParamsBase<S, D>: Forward<X, Output = Y>, Self: Activator<Y, Output = Y>,

complete a forward pass through the layer

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§