pub struct Adam<AB: AutodiffBackend, const D: usize> {
pub config: AdamConfig,
pub record: AdamRecord<AB::InnerBackend, D>,
}
Expand description
Adam optimizer as described in the paper: “Adam: A Method for Stochastic Optimization”.
Fields§
§config: AdamConfig
Configuration.
record: AdamRecord<AB::InnerBackend, D>
Record.
Implementations§
source§impl<AB: AutodiffBackend, const D: usize> Adam<AB, D>
impl<AB: AutodiffBackend, const D: usize> Adam<AB, D>
sourcepub fn update(
&mut self,
learning_rate: f64,
value: Tensor<AB, D>,
grad: Tensor<AB::InnerBackend, D>,
) -> Tensor<AB, D>
pub fn update( &mut self, learning_rate: f64, value: Tensor<AB, D>, grad: Tensor<AB::InnerBackend, D>, ) -> Tensor<AB, D>
sourcepub fn load_record(
&mut self,
record: AdamRecord<AB::InnerBackend, D>,
) -> &mut Self
pub fn load_record( &mut self, record: AdamRecord<AB::InnerBackend, D>, ) -> &mut Self
Load a record into the optimizer.
sourcepub fn into_record(self) -> AdamRecord<AB::InnerBackend, D>
pub fn into_record(self) -> AdamRecord<AB::InnerBackend, D>
Unload the record from the optimizer.
Trait Implementations§
source§impl<AB: Clone + AutodiffBackend, const D: usize> Clone for Adam<AB, D>where
AB::InnerBackend: Clone,
impl<AB: Clone + AutodiffBackend, const D: usize> Clone for Adam<AB, D>where
AB::InnerBackend: Clone,
source§impl<AB: Debug + AutodiffBackend, const D: usize> Debug for Adam<AB, D>where
AB::InnerBackend: Debug,
impl<AB: Debug + AutodiffBackend, const D: usize> Debug for Adam<AB, D>where
AB::InnerBackend: Debug,
Auto Trait Implementations§
impl<AB, const D: usize> Freeze for Adam<AB, D>where
<<AB as AutodiffBackend>::InnerBackend as Backend>::FloatTensorPrimitive: Freeze,
<<AB as AutodiffBackend>::InnerBackend as Backend>::QuantizedTensorPrimitive: Freeze,
impl<AB, const D: usize> RefUnwindSafe for Adam<AB, D>where
<<AB as AutodiffBackend>::InnerBackend as Backend>::FloatTensorPrimitive: RefUnwindSafe,
<<AB as AutodiffBackend>::InnerBackend as Backend>::QuantizedTensorPrimitive: RefUnwindSafe,
impl<AB, const D: usize> Send for Adam<AB, D>
impl<AB, const D: usize> Sync for Adam<AB, D>
impl<AB, const D: usize> Unpin for Adam<AB, D>where
<<AB as AutodiffBackend>::InnerBackend as Backend>::FloatTensorPrimitive: Unpin,
<<AB as AutodiffBackend>::InnerBackend as Backend>::QuantizedTensorPrimitive: Unpin,
impl<AB, const D: usize> UnwindSafe for Adam<AB, D>where
<<AB as AutodiffBackend>::InnerBackend as Backend>::FloatTensorPrimitive: UnwindSafe,
<<AB as AutodiffBackend>::InnerBackend as Backend>::QuantizedTensorPrimitive: UnwindSafe,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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