pub struct OptimizerOptions {
pub lr: f32,
pub weight_decay: f32,
pub eps: f32,
pub maximize: bool,
}Expand description
Common optimizer options
Fields§
§lr: f32§weight_decay: f32§eps: f32§maximize: boolImplementations§
Source§impl OptimizerOptions
impl OptimizerOptions
Sourcepub fn with_weight_decay(self, weight_decay: f32) -> Self
pub fn with_weight_decay(self, weight_decay: f32) -> Self
Set weight decay
Sourcepub fn with_maximize(self, maximize: bool) -> Self
pub fn with_maximize(self, maximize: bool) -> Self
Set maximize flag (for maximization problems)
Sourcepub fn to_hashmap(&self) -> HashMap<String, f32>
pub fn to_hashmap(&self) -> HashMap<String, f32>
Convert to HashMap for compatibility with parameter groups
Sourcepub fn from_hashmap(map: &HashMap<String, f32>) -> Self
pub fn from_hashmap(map: &HashMap<String, f32>) -> Self
Create from HashMap
Sourcepub fn create_standard_state_dict(
optimizer_type: &str,
version: Option<&str>,
param_groups: &[ParamGroup],
state: &HashMap<String, HashMap<String, Tensor>>,
global_state: Option<HashMap<String, f32>>,
) -> OptimizerState
pub fn create_standard_state_dict( optimizer_type: &str, version: Option<&str>, param_groups: &[ParamGroup], state: &HashMap<String, HashMap<String, Tensor>>, global_state: Option<HashMap<String, f32>>, ) -> OptimizerState
Create standardized state dict for any optimizer
Sourcepub fn validate_state_compatibility(
current_groups: &[ParamGroup],
state_groups: &[ParamGroupState],
) -> Result<()>
pub fn validate_state_compatibility( current_groups: &[ParamGroup], state_groups: &[ParamGroupState], ) -> Result<()>
Validate state dict compatibility between optimizers
Trait Implementations§
Source§impl Clone for OptimizerOptions
impl Clone for OptimizerOptions
Source§fn clone(&self) -> OptimizerOptions
fn clone(&self) -> OptimizerOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OptimizerOptions
impl Debug for OptimizerOptions
Auto Trait Implementations§
impl Freeze for OptimizerOptions
impl RefUnwindSafe for OptimizerOptions
impl Send for OptimizerOptions
impl Sync for OptimizerOptions
impl Unpin for OptimizerOptions
impl UnsafeUnpin for OptimizerOptions
impl UnwindSafe for OptimizerOptions
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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