pub struct SGD { /* private fields */ }
Expand description
Optimizer for Stochastic Gradient Descent.
Contrary to the PyTorch implementation of SGD, this version does not support momentum.
Implementations§
Trait Implementations§
source§impl Optimizer for SGD
impl Optimizer for SGD
type Config = f64
fn new(vars: Vec<Var>, learning_rate: f64) -> Result<Self>
fn learning_rate(&self) -> f64
fn step(&mut self, grads: &GradStore) -> Result<()>
fn set_learning_rate(&mut self, lr: f64)
fn empty(config: Self::Config) -> Result<Self>
fn backward_step(&mut self, loss: &Tensor) -> Result<()>
fn from_slice(vars: &[&Var], config: Self::Config) -> Result<Self>
Auto Trait Implementations§
impl Freeze for SGD
impl !RefUnwindSafe for SGD
impl Send for SGD
impl Sync for SGD
impl Unpin for SGD
impl !UnwindSafe for SGD
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 more