pub struct ParallelAdam { /* private fields */ }Expand description
Parallel Adam optimizer with multi-threaded parameter updates.
Implementations§
Source§impl ParallelAdam
impl ParallelAdam
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 parallel Adam optimizer.
Sourcepub fn with_config(
lr: f32,
betas: (f32, f32),
eps: f32,
weight_decay: f32,
config: ParallelConfig,
) -> Self
pub fn with_config( lr: f32, betas: (f32, f32), eps: f32, weight_decay: f32, config: ParallelConfig, ) -> Self
Creates a parallel Adam optimizer with custom configuration.
Sourcepub fn update_parallel(
&self,
updates: Vec<(String, &mut [f32], &[f32])>,
) -> Result<()>
pub fn update_parallel( &self, updates: Vec<(String, &mut [f32], &[f32])>, ) -> Result<()>
Updates multiple parameters in parallel.
Sourcepub fn parallel_stats(&self) -> ParallelStats
pub fn parallel_stats(&self) -> ParallelStats
Gets parallel performance statistics.
Sourcepub fn configure_thread_pool(&self) -> Result<()>
pub fn configure_thread_pool(&self) -> Result<()>
Configures thread pool for optimal performance.
Trait Implementations§
Source§impl BatchUpdate for ParallelAdam
impl BatchUpdate for ParallelAdam
Source§impl Debug for ParallelAdam
impl Debug for ParallelAdam
Source§impl Optimizer for ParallelAdam
impl Optimizer for ParallelAdam
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 ParallelAdam
impl RefUnwindSafe for ParallelAdam
impl Send for ParallelAdam
impl Sync for ParallelAdam
impl Unpin for ParallelAdam
impl UnwindSafe for ParallelAdam
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