Struct StepLrSchedulerConfig
pub struct StepLrSchedulerConfig { /* private fields */ }
Expand description
The configuration for create a step learning rate scheduler.
This scheduler returns the learning rate initial_lr
from the start, and keeps doing so until
the same value has been given for step_size
times. Then it multiplies the learning rate by
gamma
before repeating the process.
Gamma values out of range (0.0, 1.0) and non-positive initial learning rates are acceptable, but a warning log will be output for such a value in case of mistyping.
§Notes
The step method of the scheduler panics if it is called more than
i32::MAX + 1
times.
Implementations§
§impl StepLrSchedulerConfig
impl StepLrSchedulerConfig
pub fn new(initial_lr: f64, step_size: usize) -> StepLrSchedulerConfig
pub fn new(initial_lr: f64, step_size: usize) -> StepLrSchedulerConfig
Create a new instance of the config.
§impl StepLrSchedulerConfig
impl StepLrSchedulerConfig
pub fn with_gamma(self, gamma: f64) -> StepLrSchedulerConfig
pub fn with_gamma(self, gamma: f64) -> StepLrSchedulerConfig
The factor by which the learning rate is multiplied with each update. Default: 0.1.
§impl StepLrSchedulerConfig
impl StepLrSchedulerConfig
pub fn init(&self) -> Result<StepLrScheduler, String>
pub fn init(&self) -> Result<StepLrScheduler, String>
Trait Implementations§
§impl Clone for StepLrSchedulerConfig
impl Clone for StepLrSchedulerConfig
§fn clone(&self) -> StepLrSchedulerConfig
fn clone(&self) -> StepLrSchedulerConfig
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Config for StepLrSchedulerConfig
impl Config for StepLrSchedulerConfig
§impl<'de> Deserialize<'de> for StepLrSchedulerConfig
impl<'de> Deserialize<'de> for StepLrSchedulerConfig
§fn deserialize<D>(
deserializer: D,
) -> Result<StepLrSchedulerConfig, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<StepLrSchedulerConfig, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Display for StepLrSchedulerConfig
impl Display for StepLrSchedulerConfig
§impl Serialize for StepLrSchedulerConfig
impl Serialize for StepLrSchedulerConfig
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for StepLrSchedulerConfig
impl RefUnwindSafe for StepLrSchedulerConfig
impl Send for StepLrSchedulerConfig
impl Sync for StepLrSchedulerConfig
impl Unpin for StepLrSchedulerConfig
impl UnwindSafe for StepLrSchedulerConfig
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of [
ToCompactString::to_compact_string()
] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a [
CompactString
]. Read more