pub struct MemoryEfficientLBFGS { /* private fields */ }Expand description
Memory-efficient L-BFGS with improved history management
Implementations§
Source§impl MemoryEfficientLBFGS
impl MemoryEfficientLBFGS
pub fn new( params: Vec<Arc<RwLock<Tensor>>>, lr: Option<f32>, max_iter: Option<usize>, tolerance_grad: Option<f32>, tolerance_change: Option<f32>, history_size: Option<usize>, memory_config: Option<MemoryConfig>, ) -> Self
Sourcepub fn memory_stats(&self) -> HashMap<String, usize>
pub fn memory_stats(&self) -> HashMap<String, usize>
Get memory usage statistics
Sourcepub fn clear_memory(&mut self)
pub fn clear_memory(&mut self)
Clear memory pools and history to free up memory
Trait Implementations§
Source§impl Optimizer for MemoryEfficientLBFGS
impl Optimizer for MemoryEfficientLBFGS
Source§fn step(&mut self) -> OptimizerResult<()>
fn step(&mut self) -> OptimizerResult<()>
Perform a single optimization step
Source§fn add_param_group(
&mut self,
params: Vec<Arc<RwLock<Tensor>>>,
options: HashMap<String, f32>,
)
fn add_param_group( &mut self, params: Vec<Arc<RwLock<Tensor>>>, options: HashMap<String, f32>, )
Add a parameter group
Source§fn state_dict(&self) -> OptimizerResult<OptimizerState>
fn state_dict(&self) -> OptimizerResult<OptimizerState>
Get state dict for serialization
Source§fn load_state_dict(&mut self, state: OptimizerState) -> OptimizerResult<()>
fn load_state_dict(&mut self, state: OptimizerState) -> OptimizerResult<()>
Load state dict
Auto Trait Implementations§
impl Freeze for MemoryEfficientLBFGS
impl !RefUnwindSafe for MemoryEfficientLBFGS
impl Send for MemoryEfficientLBFGS
impl Sync for MemoryEfficientLBFGS
impl Unpin for MemoryEfficientLBFGS
impl UnsafeUnpin for MemoryEfficientLBFGS
impl !UnwindSafe for MemoryEfficientLBFGS
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> 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 moreSource§impl<O> OptimizerExt for Owhere
O: Optimizer,
impl<O> OptimizerExt for Owhere
O: Optimizer,
Source§fn distributed(
self,
config: DistributedConfig,
) -> OptimizerResult<DistributedOptimizer<Self>>
fn distributed( self, config: DistributedConfig, ) -> OptimizerResult<DistributedOptimizer<Self>>
Wrap this optimizer with distributed functionality