Type Alias DeepParamsBase

Source
pub type DeepParamsBase<S, D> = ModelParamsBase<S, D, Vec<ParamsBase<S, D>>>;
Expand description

a type alias for a deep representation of the ModelParamsBase using a vector of parameters as the hidden layers.

Aliased Type§

pub struct DeepParamsBase<S, D> { /* private fields */ }

Implementations§

Source§

impl<A, S, D> DeepParamsBase<S, D>
where D: Dimension, S: RawData<Elem = A>,

Source

pub fn size(&self) -> usize

returns the total number parameters within the model, including the input and output layers

Source

pub fn set_hidden_layer( &mut self, idx: usize, layer: ParamsBase<S, D>, ) -> &mut Self

set the layer at the specified index in the hidden layers of the model

§Panics

Panics if the index is out of bounds or if the dimension of the provided layer is inconsistent with the others in the stack.

Source

pub fn dim_input(&self) -> <D as Dimension>::Pattern

returns the dimension of the input layer

Source

pub fn dim_hidden(&self) -> <D as Dimension>::Pattern

returns the dimension of the hidden layers

Source

pub fn dim_output(&self) -> <D as Dimension>::Pattern

returns the dimension of the output layer

Source

pub fn get_hidden_layer<I>(&self, idx: I) -> Option<&I::Output>
where I: SliceIndex<[ParamsBase<S, D>]>,

returns the hidden layer associated with the given index

Source

pub fn get_hidden_layer_mut<I>(&mut self, idx: I) -> Option<&mut I::Output>
where I: SliceIndex<[ParamsBase<S, D>]>,

returns a mutable reference to the hidden layer associated with the given index

Source

pub fn forward<X, Y>(&self, input: &X) -> Result<Y>
where A: Clone, S: Data, ParamsBase<S, D>: Forward<X, Output = Y> + Forward<Y, Output = Y>,

sequentially forwards the input through the model without any activations or other complexities in-between. not overly usefuly, but it is here for completeness

Source§

impl<A, S> DeepParamsBase<S, Ix2>
where S: RawData<Elem = A>,

Source

pub fn default(features: ModelFeatures) -> Self
where A: Clone + Default, S: DataOwned,

create a new instance of the model; all parameters are initialized to their defaults (i.e., zero)

Source

pub fn ones(features: ModelFeatures) -> Self
where A: Clone + One, S: DataOwned,

create a new instance of the model; all parameters are initialized to zero

Source

pub fn zeros(features: ModelFeatures) -> Self
where A: Clone + Zero, S: DataOwned,

create a new instance of the model; all parameters are initialized to zero

Source§

impl<A, S> DeepParamsBase<S, Ix2>
where S: DataOwned<Elem = A>,

Source

pub fn init_rand<G, Ds>(features: ModelFeatures, distr: G) -> Self
where G: Fn((usize, usize)) -> Ds, Ds: Clone + Distribution<A>, S: DataOwned,

returns a new instance of the model initialized with the given features and random distribution

Source

pub fn glorot_normal(features: ModelFeatures) -> Self

initialize the model parameters using a glorot normal distribution

Source

pub fn glorot_uniform(features: ModelFeatures) -> Self

initialize the model parameters using a glorot uniform distribution