pub struct SgdConfig {
pub lr: f32,
pub momentum: Option<Momentum>,
pub weight_decay: Option<WeightDecay>,
}
Expand description
Configuration of hyperparameters for Sgd.
Using different learning rate:
SgdConfig {
lr: 1e-1,
momentum: None,
weight_decay: None,
};
Using classic momentum:
SgdConfig {
lr: 1e-2,
momentum: Some(Momentum::Classic(0.5)),
weight_decay: None,
};
Using nesterov momentum:
SgdConfig {
lr: 1e-3,
momentum: Some(Momentum::Nesterov(0.25)),
weight_decay: None,
};
Using L2 weight decay:
SgdConfig {
lr: 1e-3,
momentum: None,
weight_decay: Some(WeightDecay::L2(1e-2)),
};
Using decoupled weight decay:
SgdConfig {
lr: 1e-3,
momentum: None,
weight_decay: Some(WeightDecay::Decoupled(1e-2)),
};
Fields
lr: f32
Learning rate. Defaults to 1e-2
momentum: Option<Momentum>
Optional momentum. Defaults to None
.
weight_decay: Option<WeightDecay>
Optional weight decay. Defaults to None
.
Trait Implementations
impl Copy for SgdConfig
Auto Trait Implementations
impl RefUnwindSafe for SgdConfig
impl Send for SgdConfig
impl Sync for SgdConfig
impl Unpin for SgdConfig
impl UnwindSafe for SgdConfig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more