Skip to main content

Weighted

Trait Weighted 

Source
pub trait Weighted<S, D, A = <S as RawData>::Elem>: Sized
where D: Dimension, S: RawData<Elem = A>,
{ type Tensor<_S, _D, _A> where _D: Dimension, _S: RawData<Elem = _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§

Source

type Tensor<_S, _D, _A> where _D: Dimension, _S: RawData<Elem = _A>

Required Methods§

Source

fn weights(&self) -> &Self::Tensor<S, D, A>

returns the weights of the model

Source

fn weights_mut(&mut self) -> &mut Self::Tensor<S, D, A>

returns a mutable reference to the weights of the model

Provided Methods§

Source

fn replace_weights( &mut self, weights: Self::Tensor<S, D, A>, ) -> Self::Tensor<S, D, A>

replaces the current weights with the given weights

Source

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".

Implementors§

Source§

impl<A, S, D> Weighted<S, D, A> for ParamsBase<S, D, A>
where S: RawData<Elem = A>, D: Dimension,

Source§

type Tensor<_S, _D, _A> = ArrayBase<_S, _D, _A> where _D: Dimension, _S: RawData<Elem = _A>