pub struct PyTorchAdam { /* private fields */ }Expand description
PyTorch-compatible Adam optimizer
Implementations§
Source§impl PyTorchAdam
impl PyTorchAdam
Sourcepub fn new(
params: Vec<PyTorchParamGroup>,
lr: f64,
betas: (f64, f64),
eps: f64,
weight_decay: f64,
_amsgrad: bool,
) -> Result<Self>
pub fn new( params: Vec<PyTorchParamGroup>, lr: f64, betas: (f64, f64), eps: f64, weight_decay: f64, _amsgrad: bool, ) -> Result<Self>
Create new PyTorch-compatible Adam optimizer
Sourcepub fn from_params(
params: impl IntoIterator<Item = (String, Tensor)>,
) -> Result<Self>
pub fn from_params( params: impl IntoIterator<Item = (String, Tensor)>, ) -> Result<Self>
Create with default parameters
Sourcepub fn from_config(config: PyTorchOptimizerConfig) -> Result<Self>
pub fn from_config(config: PyTorchOptimizerConfig) -> Result<Self>
Create PyTorch Adam optimizer from configuration
Sourcepub fn from_cross_framework_config(
config: PyTorchOptimizerConfig,
) -> Result<Self>
pub fn from_cross_framework_config( config: PyTorchOptimizerConfig, ) -> Result<Self>
Create PyTorch Adam optimizer from cross-framework configuration
Trait Implementations§
Source§impl Debug for PyTorchAdam
impl Debug for PyTorchAdam
Source§impl PyTorchOptimizer for PyTorchAdam
impl PyTorchOptimizer for PyTorchAdam
Source§fn param_groups(&self) -> &[PyTorchParamGroup]
fn param_groups(&self) -> &[PyTorchParamGroup]
Get parameter groups
Source§fn param_groups_mut(&mut self) -> &mut [PyTorchParamGroup]
fn param_groups_mut(&mut self) -> &mut [PyTorchParamGroup]
Get mutable parameter groups
Source§fn state_dict(&self) -> PyTorchOptimizerState
fn state_dict(&self) -> PyTorchOptimizerState
Get optimizer state
Source§fn load_state_dict(&mut self, state: PyTorchOptimizerState) -> Result<()>
fn load_state_dict(&mut self, state: PyTorchOptimizerState) -> Result<()>
Load optimizer state
Source§fn step(&mut self, closure: Option<Box<dyn Fn() -> f64>>) -> Result<Option<f64>>
fn step(&mut self, closure: Option<Box<dyn Fn() -> f64>>) -> Result<Option<f64>>
Perform optimization step
Source§fn add_param_group(&mut self, param_group: PyTorchParamGroup) -> Result<()>
fn add_param_group(&mut self, param_group: PyTorchParamGroup) -> Result<()>
Add parameter group
Source§fn defaults(&self) -> PyTorchParamGroup
fn defaults(&self) -> PyTorchParamGroup
Get defaults
Auto Trait Implementations§
impl Freeze for PyTorchAdam
impl RefUnwindSafe for PyTorchAdam
impl Send for PyTorchAdam
impl Sync for PyTorchAdam
impl Unpin for PyTorchAdam
impl UnwindSafe for PyTorchAdam
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