pub enum ModelFormat {
Shallow {
hidden: usize,
},
Deep {
hidden: usize,
layers: usize,
},
}Expand description
The ModelFormat type enumerates the various formats a neural network may take, either
shallow or deep, providing a unified interface for accessing the number of hidden features
and layers in the model. This is done largely for simplicity, as it eliminates the need to
define a particular type of network as its composition has little impact on the actual
requirements / algorithms used to train or evaluate the model (that is, outside of the
obvious need to account for additional hidden layers in deep configurations). In other
words, both shallow and deep networks are requried to implement the same traits and
fulfill the same requirements, so it makes sense to treat them as a single type with
different configurations. The differences between the networks are largely left to the
developer and their choice of activation functions, optimizers, and other considerations.
Variants§
Implementations§
Source§impl ModelFormat
impl ModelFormat
Sourcepub const fn is_shallow(&self) -> bool
pub const fn is_shallow(&self) -> bool
Returns true if the enum is ModelFormat::Shallow otherwise false
Source§impl ModelFormat
impl ModelFormat
Sourcepub const fn deep(hidden: usize, layers: usize) -> Self
pub const fn deep(hidden: usize, layers: usize) -> Self
initialize a new Deep variant for a deep neural network with the
given number of hidden features and layers
Sourcepub const fn shallow(hidden: usize) -> Self
pub const fn shallow(hidden: usize) -> Self
create a new instance of ModelFormat for a shallow neural network, using the given
number of hidden features
returns a copy of the number of hidden features
returns a mutable reference to the hidden features for the model
Sourcepub const fn layers_mut(&mut self) -> &mut usize
pub const fn layers_mut(&mut self) -> &mut usize
returns a mutable reference to the number of layers for the model; this will panic on
Shallow variants
update the number of hidden features for the model
Sourcepub fn set_layers(&mut self, value: usize) -> &mut Self
pub fn set_layers(&mut self, value: usize) -> &mut Self
consumes the current instance and returns a new instance with the given hidden features
Sourcepub fn with_layers(self, layers: usize) -> Self
pub fn with_layers(self, layers: usize) -> Self
Trait Implementations§
Source§impl Clone for ModelFormat
impl Clone for ModelFormat
Source§fn clone(&self) -> ModelFormat
fn clone(&self) -> ModelFormat
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelFormat
impl Debug for ModelFormat
Source§impl Default for ModelFormat
impl Default for ModelFormat
Source§impl<'de> Deserialize<'de> for ModelFormat
impl<'de> Deserialize<'de> for ModelFormat
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for ModelFormat
impl Display for ModelFormat
Source§impl Hash for ModelFormat
impl Hash for ModelFormat
Source§impl Ord for ModelFormat
impl Ord for ModelFormat
Source§fn cmp(&self, other: &ModelFormat) -> Ordering
fn cmp(&self, other: &ModelFormat) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ModelFormat
impl PartialEq for ModelFormat
Source§impl PartialOrd for ModelFormat
impl PartialOrd for ModelFormat
Source§impl Serialize for ModelFormat
impl Serialize for ModelFormat
impl Copy for ModelFormat
impl Eq for ModelFormat
impl StructuralPartialEq for ModelFormat
Auto Trait Implementations§
impl Freeze for ModelFormat
impl RefUnwindSafe for ModelFormat
impl Send for ModelFormat
impl Sync for ModelFormat
impl Unpin for ModelFormat
impl UnwindSafe for ModelFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CallInPlace<T> for Twhere
T: CallInto<T>,
impl<T> CallInPlace<T> for Twhere
T: CallInto<T>,
Source§fn call_inplace<F>(&mut self, f: F) -> <T as CallInto<T>>::Output
fn call_inplace<F>(&mut self, f: F) -> <T as CallInto<T>>::Output
call_on_mut method allows an object to be passed onto a function that takes a mutable reference
to the object. This is useful for cases where you want to perform an operation on
an object and mutate it in the process.Source§impl<T> CallInto<T> for T
impl<T> CallInto<T> for T
Source§impl<T> CallOn<T> for Twhere
T: CallInto<T>,
impl<T> CallOn<T> for Twhere
T: CallInto<T>,
Source§fn call_on<F>(&self, f: F) -> <T as CallInto<T>>::Output
fn call_on<F>(&self, f: F) -> <T as CallInto<T>>::Output
call_on method allows an object to be passed onto a function that takes a reference
to the object. This is useful for cases where you want to perform an operation on
an object without needing to extract it from a container or context.