pub trait Weighted<S, D, A = <S as RawData>::Elem>: Sized{
type Tensor<_S: RawData<Elem = _A>, _D: Dimension, _A>;
// Required methods
fn weights(&self) -> &Self::Tensor<S, D, A>;
fn weights_mut(&mut self) -> &mut Self::Tensor<S, D, A>;
// Provided methods
fn replace_weights(
&mut self,
weights: Self::Tensor<S, D, A>,
) -> Self::Tensor<S, D, A> { ... }
fn set_weights(&mut self, weights: Self::Tensor<S, D, A>) -> &mut Self { ... }
}Expand description
A trait denoting an implementor with weights and associated methods
Required Associated Types§
Required Methods§
Sourcefn weights_mut(&mut self) -> &mut Self::Tensor<S, D, A>
fn weights_mut(&mut self) -> &mut Self::Tensor<S, D, A>
returns a mutable reference to the weights of the model
Provided Methods§
Sourcefn replace_weights(
&mut self,
weights: Self::Tensor<S, D, A>,
) -> Self::Tensor<S, D, A>
fn replace_weights( &mut self, weights: Self::Tensor<S, D, A>, ) -> Self::Tensor<S, D, A>
replaces the current weights with the given weights
Sourcefn set_weights(&mut self, weights: Self::Tensor<S, D, A>) -> &mut Self
fn set_weights(&mut self, weights: Self::Tensor<S, D, A>) -> &mut Self
sets the weights of the model
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.