pub enum ModelFormat {
Layer,
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 primarily used to generalize the allowed formats of a
neural network without introducing any additional complexity with typing or other
constructs.
Variants§
Implementations§
Source§impl ModelFormat
impl ModelFormat
pub const fn new(hidden: usize, layers: usize) -> Self
pub const fn layer() -> Self
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
Source§impl ModelFormat
impl ModelFormat
Sourcepub const fn is_layer(&self) -> bool
pub const fn is_layer(&self) -> bool
Returns true if the enum is ModelFormat::Layer otherwise false
Sourcepub const fn is_shallow(&self) -> bool
pub const fn is_shallow(&self) -> bool
Returns true if the enum is ModelFormat::Shallow otherwise false
Trait Implementations§
Source§impl Clone for ModelFormat
impl Clone for ModelFormat
Source§fn clone(&self) -> ModelFormat
fn clone(&self) -> ModelFormat
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
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 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
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.