pub struct SGDM<D: Device> {
pub params: Vec<SGDMParam<D>>,
pub learning_rate: f64,
pub momentum: f64,
}Fields§
§params: Vec<SGDMParam<D>>§learning_rate: f64§momentum: f64Trait Implementations§
Source§impl<D: Device> Optimizer for SGDM<D>
impl<D: Device> Optimizer for SGDM<D>
Source§fn step(&mut self, grads: &GradStore<Self::Device>) -> Result<()>
fn step(&mut self, grads: &GradStore<Self::Device>) -> Result<()>
v = m*v + grad
w_t = w_{t-1} - lr * v
type Device = D
fn get_lr(&self) -> f64
fn set_lr(&mut self, lr: f64)
fn state_dict(&self) -> Result<LumaPack<Self::Device>>
fn load_state_dict(&mut self, pack: &LumaPack<Self::Device>) -> Result<()>
Auto Trait Implementations§
impl<D> Freeze for SGDM<D>
impl<D> RefUnwindSafe for SGDM<D>
impl<D> Send for SGDM<D>
impl<D> Sync for SGDM<D>
impl<D> Unpin for SGDM<D>
impl<D> UnsafeUnpin for SGDM<D>
impl<D> UnwindSafe for SGDM<D>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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