pub struct LayoutOptimizedAdam { /* private fields */ }Expand description
Memory-optimized Adam optimizer using SoA layout.
Implementations§
Source§impl LayoutOptimizedAdam
impl LayoutOptimizedAdam
Sourcepub fn new(lr: f32, betas: (f32, f32), eps: f32, weight_decay: f32) -> Self
pub fn new(lr: f32, betas: (f32, f32), eps: f32, weight_decay: f32) -> Self
Creates a new layout-optimized Adam optimizer.
Sourcepub fn with_alignment(
lr: f32,
betas: (f32, f32),
eps: f32,
weight_decay: f32,
alignment: AlignmentConfig,
) -> Self
pub fn with_alignment( lr: f32, betas: (f32, f32), eps: f32, weight_decay: f32, alignment: AlignmentConfig, ) -> Self
Creates an optimizer with custom alignment configuration.
Sourcepub fn avx512_optimized(
lr: f32,
betas: (f32, f32),
eps: f32,
weight_decay: f32,
) -> Self
pub fn avx512_optimized( lr: f32, betas: (f32, f32), eps: f32, weight_decay: f32, ) -> Self
Creates an AVX-512 optimized variant.
Sourcepub fn layout_stats(&self) -> LayoutStats
pub fn layout_stats(&self) -> LayoutStats
Gets layout optimization statistics.
Trait Implementations§
Source§impl Debug for LayoutOptimizedAdam
impl Debug for LayoutOptimizedAdam
Source§impl Optimizer for LayoutOptimizedAdam
impl Optimizer for LayoutOptimizedAdam
Source§fn update(&mut self, parameter: &mut Tensor, grad: &Tensor) -> Result<()>
fn update(&mut self, parameter: &mut Tensor, grad: &Tensor) -> Result<()>
Updates a parameter based on its gradient. Read more
Source§fn accumulate_grad(
&mut self,
parameter: &mut Tensor,
grad: &Tensor,
) -> Result<(), TrustformersError>
fn accumulate_grad( &mut self, parameter: &mut Tensor, grad: &Tensor, ) -> Result<(), TrustformersError>
Accumulates gradients for gradient accumulation. Read more
Source§fn apply_accumulated_grads(
&mut self,
accumulation_steps: usize,
) -> Result<(), TrustformersError>
fn apply_accumulated_grads( &mut self, accumulation_steps: usize, ) -> Result<(), TrustformersError>
Applies accumulated gradients after gradient accumulation. Read more
impl Send for LayoutOptimizedAdam
impl Sync for LayoutOptimizedAdam
Auto Trait Implementations§
impl Freeze for LayoutOptimizedAdam
impl RefUnwindSafe for LayoutOptimizedAdam
impl Unpin for LayoutOptimizedAdam
impl UnwindSafe for LayoutOptimizedAdam
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