pub struct SoAOptimizerState { /* private fields */ }Expand description
Structure of Arrays (SoA) layout for optimizer state.
This layout stores momentum and variance in separate aligned arrays to improve vectorization and cache utilization.
Implementations§
Source§impl SoAOptimizerState
impl SoAOptimizerState
Sourcepub fn new(alignment: AlignmentConfig) -> Self
pub fn new(alignment: AlignmentConfig) -> Self
Creates a new SoA optimizer state.
Sourcepub fn add_parameter(&mut self, id: String, size: usize) -> Result<()>
pub fn add_parameter(&mut self, id: String, size: usize) -> Result<()>
Adds a parameter to the SoA layout.
Sourcepub fn get_parameter_info(&self, id: &str) -> Option<&ParameterInfo>
pub fn get_parameter_info(&self, id: &str) -> Option<&ParameterInfo>
Gets parameter information by ID.
Sourcepub fn update_parameter_soa(
&mut self,
param_id: &str,
param: &mut [f32],
grad: &[f32],
lr: f32,
betas: (f32, f32),
eps: f32,
weight_decay: f32,
) -> Result<()>
pub fn update_parameter_soa( &mut self, param_id: &str, param: &mut [f32], grad: &[f32], lr: f32, betas: (f32, f32), eps: f32, weight_decay: f32, ) -> Result<()>
Updates momentum and variance for a parameter using optimized memory access.
Sourcepub fn layout_stats(&self) -> LayoutStats
pub fn layout_stats(&self) -> LayoutStats
Gets memory layout statistics.
Trait Implementations§
Source§impl Debug for SoAOptimizerState
impl Debug for SoAOptimizerState
impl Send for SoAOptimizerState
impl Sync for SoAOptimizerState
Auto Trait Implementations§
impl Freeze for SoAOptimizerState
impl RefUnwindSafe for SoAOptimizerState
impl Unpin for SoAOptimizerState
impl UnwindSafe for SoAOptimizerState
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