pub struct FusedOptimizer { /* private fields */ }Expand description
Fused optimizer that combines multiple optimizers for efficiency
Implementations§
Source§impl FusedOptimizer
impl FusedOptimizer
Sourcepub fn new(
optimizers: Vec<Box<dyn Optimizer>>,
config: FusionConfig,
) -> Result<Self>
pub fn new( optimizers: Vec<Box<dyn Optimizer>>, config: FusionConfig, ) -> Result<Self>
Create a new fused optimizer
Sourcepub fn fused_step(
&mut self,
parameters: &mut HashMap<String, Tensor>,
) -> Result<()>
pub fn fused_step( &mut self, parameters: &mut HashMap<String, Tensor>, ) -> Result<()>
Perform fused optimization step
Sourcepub fn register_gradient(
&self,
param_name: &str,
gradient: Tensor,
) -> Result<()>
pub fn register_gradient( &self, param_name: &str, gradient: Tensor, ) -> Result<()>
Register gradient for parameter in the fused gradient registry
This method allows external automatic differentiation systems to register computed gradients with the fused optimizer for parameter updates.
Sourcepub fn clear_gradients(&self) -> Result<()>
pub fn clear_gradients(&self) -> Result<()>
Clear all registered gradients
This should be called after each optimization step to clear accumulated gradients.
Sourcepub fn get_available_gradient_names(&self) -> Result<Vec<String>>
pub fn get_available_gradient_names(&self) -> Result<Vec<String>>
Get all available gradient parameter names
Returns a list of parameter names for which gradients are currently available.
Sourcepub fn get_fusion_stats(&self) -> FusionStats
pub fn get_fusion_stats(&self) -> FusionStats
Get fusion statistics
Auto Trait Implementations§
impl Freeze for FusedOptimizer
impl !RefUnwindSafe for FusedOptimizer
impl Send for FusedOptimizer
impl Sync for FusedOptimizer
impl Unpin for FusedOptimizer
impl !UnwindSafe for FusedOptimizer
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