pub struct KernelFusedAdam { /* private fields */ }Expand description
Kernel fusion optimized Adam optimizer.
Implementations§
Source§impl KernelFusedAdam
impl KernelFusedAdam
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 kernel fused Adam optimizer.
Sourcepub fn with_config(
lr: f32,
betas: (f32, f32),
eps: f32,
weight_decay: f32,
config: KernelFusionConfig,
) -> Self
pub fn with_config( lr: f32, betas: (f32, f32), eps: f32, weight_decay: f32, config: KernelFusionConfig, ) -> Self
Creates optimizer with specific GPU configuration.
Sourcepub fn for_a100(lr: f32, betas: (f32, f32), eps: f32, weight_decay: f32) -> Self
pub fn for_a100(lr: f32, betas: (f32, f32), eps: f32, weight_decay: f32) -> Self
Creates A100-optimized variant.
Sourcepub fn for_h100(lr: f32, betas: (f32, f32), eps: f32, weight_decay: f32) -> Self
pub fn for_h100(lr: f32, betas: (f32, f32), eps: f32, weight_decay: f32) -> Self
Creates H100-optimized variant.
Sourcepub fn update_fused(
&mut self,
params: Vec<(&str, &mut [f32], &[f32])>,
) -> Result<()>
pub fn update_fused( &mut self, params: Vec<(&str, &mut [f32], &[f32])>, ) -> Result<()>
Updates multiple parameters using fused kernels.
Sourcepub fn gpu_stats(&self) -> GPUMemoryStats
pub fn gpu_stats(&self) -> GPUMemoryStats
Gets GPU performance statistics.
Trait Implementations§
Source§impl Debug for KernelFusedAdam
impl Debug for KernelFusedAdam
Source§impl Optimizer for KernelFusedAdam
impl Optimizer for KernelFusedAdam
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
Auto Trait Implementations§
impl Freeze for KernelFusedAdam
impl RefUnwindSafe for KernelFusedAdam
impl Send for KernelFusedAdam
impl Sync for KernelFusedAdam
impl Unpin for KernelFusedAdam
impl UnwindSafe for KernelFusedAdam
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