pub struct ModelParams<A = f64> { /* private fields */ }Expand description
This object is an abstraction over the parameters of a deep neural network model. This is done to isolate the necessary parameters from the specific logic within a model allowing us to easily create additional stores for tracking velocities, gradients, and other metrics we may need.
Additionally, this provides us with a way to introduce common creation routines for initializing neural networks.
Implementations§
Source§impl<A> ModelParams<A>
impl<A> ModelParams<A>
Sourcepub fn default(features: ModelFeatures) -> Self
pub fn default(features: ModelFeatures) -> Self
create a new instance of the model; all parameters are initialized to their defaults (i.e., zero)
Sourcepub fn ones(features: ModelFeatures) -> Self
pub fn ones(features: ModelFeatures) -> Self
create a new instance of the model; all parameters are initialized to zero
Sourcepub fn zeros(features: ModelFeatures) -> Self
pub fn zeros(features: ModelFeatures) -> Self
create a new instance of the model; all parameters are initialized to zero
Sourcepub fn is_shallow(&self) -> bool
pub fn is_shallow(&self) -> bool
returns true if the stack is shallow
Sourcepub const fn input(&self) -> &Params<A>
pub const fn input(&self) -> &Params<A>
returns an immutable reference to the input layer of the model
Sourcepub fn input_mut(&mut self) -> &mut Params<A>
pub fn input_mut(&mut self) -> &mut Params<A>
returns a mutable reference to the input layer of the model
returns an immutable reference to the hidden layers of the model
returns an immutable reference to the hidden layers of the model as a slice
returns a mutable reference to the hidden layers of the model
Sourcepub const fn output(&self) -> &Params<A>
pub const fn output(&self) -> &Params<A>
returns an immutable reference to the output layer of the model
Sourcepub fn output_mut(&mut self) -> &mut Params<A>
pub fn output_mut(&mut self) -> &mut Params<A>
returns a mutable reference to the output layer of the model
set the hidden layers of the model
Sourcepub fn set_output(&mut self, output: Params<A>)
pub fn set_output(&mut self, output: Params<A>)
set the output layer of the model
Sourcepub fn with_input(self, input: Params<A>) -> Self
pub fn with_input(self, input: Params<A>) -> Self
consumes the current instance and returns another with the specified input layer
consumes the current instance and returns another with the specified hidden layers
Sourcepub fn with_output(self, output: Params<A>) -> Self
pub fn with_output(self, output: Params<A>) -> Self
consumes the current instance and returns another with the specified output layer
pub fn dim_input(&self) -> (usize, usize)
pub fn dim_output(&self) -> (usize, usize)
pub fn forward<X, Y>(&self, input: &X) -> Result<Y>
Trait Implementations§
Source§impl<A: Clone> Clone for ModelParams<A>
impl<A: Clone> Clone for ModelParams<A>
Source§fn clone(&self) -> ModelParams<A>
fn clone(&self) -> ModelParams<A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more