pub struct PyTorchAdamW { /* private fields */ }Expand description
PyTorch-compatible AdamW optimizer
Implementations§
Source§impl PyTorchAdamW
impl PyTorchAdamW
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 AdamW 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
Trait Implementations§
Source§impl Debug for PyTorchAdamW
impl Debug for PyTorchAdamW
Source§impl PyTorchOptimizer for PyTorchAdamW
impl PyTorchOptimizer for PyTorchAdamW
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 PyTorchAdamW
impl RefUnwindSafe for PyTorchAdamW
impl Send for PyTorchAdamW
impl Sync for PyTorchAdamW
impl Unpin for PyTorchAdamW
impl UnwindSafe for PyTorchAdamW
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