pub struct ModelParameters {
pub parameter_count: usize,
pub parameter_names: Vec<String>,
pub parameter_shapes: HashMap<String, Vec<usize>>,
pub total_memory_bytes: usize,
}Expand description
Model parameters for ZeRO-3 initialization
Fields§
§parameter_count: usize§parameter_names: Vec<String>§parameter_shapes: HashMap<String, Vec<usize>>§total_memory_bytes: usizeImplementations§
Source§impl ModelParameters
impl ModelParameters
Sourcepub fn add_parameter(&mut self, name: String, shape: Vec<usize>)
pub fn add_parameter(&mut self, name: String, shape: Vec<usize>)
Add a parameter to the collection
Sourcepub fn has_parameter(&self, name: &str) -> bool
pub fn has_parameter(&self, name: &str) -> bool
Check if a parameter exists
Sourcepub fn add_parameter_with_size(
&mut self,
name: String,
shape: Vec<usize>,
element_size: usize,
)
pub fn add_parameter_with_size( &mut self, name: String, shape: Vec<usize>, element_size: usize, )
Add a parameter with custom element size
Sourcepub fn get_parameter_shape(&self, name: &str) -> Option<&Vec<usize>>
pub fn get_parameter_shape(&self, name: &str) -> Option<&Vec<usize>>
Get the shape of a parameter by name
Sourcepub fn get_parameter_size(&self, name: &str) -> Option<usize>
pub fn get_parameter_size(&self, name: &str) -> Option<usize>
Get the number of elements in a parameter
Sourcepub fn total_parameters(&self) -> usize
pub fn total_parameters(&self) -> usize
Get total number of parameters
Sourcepub fn memory_usage_mb(&self) -> f64
pub fn memory_usage_mb(&self) -> f64
Get memory usage in MB
Sourcepub fn get_statistics(&self) -> ModelParameterStats
pub fn get_statistics(&self) -> ModelParameterStats
Get parameter statistics
Trait Implementations§
Source§impl Debug for ModelParameters
impl Debug for ModelParameters
Auto Trait Implementations§
impl Freeze for ModelParameters
impl RefUnwindSafe for ModelParameters
impl Send for ModelParameters
impl Sync for ModelParameters
impl Unpin for ModelParameters
impl UnsafeUnpin for ModelParameters
impl UnwindSafe for ModelParameters
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more