RawLayerMut

Trait RawLayerMut 

Source
pub trait RawLayerMut<F, A>: RawLayer<F, A>
where F: Activator<A>, Self::Params<A>: RawParams<Elem = A>,
{ // Required method fn params_mut(&mut self) -> &mut Self::Params<A>; // Provided methods fn backward<X, Y, Z, Dt>(&mut self, input: X, error: Y, gamma: A) where A: Clone, F: ActivatorGradient<Y, Rel = F, Delta = Dt>, Self::Params<A>: Backward<X, Dt, Elem = A> { ... } fn set_params(&mut self, params: Self::Params<A>) { ... } fn replace_params(&mut self, params: Self::Params<A>) -> Self::Params<A> { ... } fn swap_params(&mut self, other: &mut Self::Params<A>) { ... } }
Expand description

The RawLayerMut trait extends the RawLayer trait by providing mutable access to the layer’s parameters and additional methods for training the layer, such as backward propagation and parameter updates.

Required Methods§

Source

fn params_mut(&mut self) -> &mut Self::Params<A>

returns a mutable reference to the parameters of the layer

Provided Methods§

Source

fn backward<X, Y, Z, Dt>(&mut self, input: X, error: Y, gamma: A)
where A: Clone, F: ActivatorGradient<Y, Rel = F, Delta = Dt>, Self::Params<A>: Backward<X, Dt, Elem = A>,

backward propagate error through the layer

Source

fn set_params(&mut self, params: Self::Params<A>)

update the layer parameters

Source

fn replace_params(&mut self, params: Self::Params<A>) -> Self::Params<A>

replace the params of the layer, returning the previous value

Source

fn swap_params(&mut self, other: &mut Self::Params<A>)

swap the params of the layer with another

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§

Source§

impl<F, P, A> RawLayerMut<F, A> for LayerBase<F, P>
where F: Activator<A>, P: RawParams<Elem = A>,