pub struct MultiOptimizerTrainer { /* private fields */ }Expand description
Multi-optimizer training system
Implementations§
Source§impl MultiOptimizerTrainer
impl MultiOptimizerTrainer
Sourcepub fn add_optimizer(
&mut self,
name: String,
optimizer: Box<dyn Optimizer>,
weight: f64,
) -> Result<()>
pub fn add_optimizer( &mut self, name: String, optimizer: Box<dyn Optimizer>, weight: f64, ) -> Result<()>
Add an optimizer with a name
Sourcepub fn add_scheduler(
&mut self,
optimizer_name: String,
scheduler: Box<dyn LRScheduler>,
) -> Result<()>
pub fn add_scheduler( &mut self, optimizer_name: String, scheduler: Box<dyn LRScheduler>, ) -> Result<()>
Add a scheduler for an optimizer
Sourcepub fn assign_parameters(
&mut self,
assignments: HashMap<String, String>,
) -> Result<()>
pub fn assign_parameters( &mut self, assignments: HashMap<String, String>, ) -> Result<()>
Assign parameters to optimizers
Sourcepub fn step(
&mut self,
parameters: &HashMap<String, Tensor>,
gradients: &HashMap<String, Tensor>,
) -> Result<()>
pub fn step( &mut self, parameters: &HashMap<String, Tensor>, gradients: &HashMap<String, Tensor>, ) -> Result<()>
Perform multi-optimizer training step
Sourcepub fn step_schedulers(&mut self, epoch: usize) -> Result<()>
pub fn step_schedulers(&mut self, epoch: usize) -> Result<()>
Update learning rates using schedulers
Sourcepub fn get_stats(&self) -> MultiOptimizerStats
pub fn get_stats(&self) -> MultiOptimizerStats
Get training statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MultiOptimizerTrainer
impl !RefUnwindSafe for MultiOptimizerTrainer
impl Send for MultiOptimizerTrainer
impl Sync for MultiOptimizerTrainer
impl Unpin for MultiOptimizerTrainer
impl !UnwindSafe for MultiOptimizerTrainer
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