pub struct WeightDecay<Opt, V> {
pub optimizer: Opt,
pub lambda: V,
}Expand description
L2 weight decay around an optimizer (C++ L2WeightDecay): before each
update every connection weight, but no bias weight, becomes
w - (learning rate * lambda) * w, then optimizer takes its step.
tinymind (C++)’s default lambda is 0.001 rounded to the format and kept at
one LSB or more: Q16_16::from_raw(66) and Q8_8::from_raw(1) (0.001 is
below one Q8.8 LSB). A lambda of 0 gives the same results as optimizer
alone.
Fields§
§optimizer: OptThe optimizer that takes each step after the decay.
lambda: VThe decay rate.
Implementations§
Source§impl<Opt, V> WeightDecay<Opt, V>
impl<Opt, V> WeightDecay<Opt, V>
Trait Implementations§
impl<Opt: Copy, V: Copy> Copy for WeightDecay<Opt, V>
impl<Opt: Eq, V: Eq> Eq for WeightDecay<Opt, V>
impl<Opt: PartialEq, V: PartialEq> StructuralPartialEq for WeightDecay<Opt, V>
Auto Trait Implementations§
impl<Opt, V> Freeze for WeightDecay<Opt, V>
impl<Opt, V> RefUnwindSafe for WeightDecay<Opt, V>where
Opt: RefUnwindSafe,
V: RefUnwindSafe,
impl<Opt, V> Send for WeightDecay<Opt, V>
impl<Opt, V> Sync for WeightDecay<Opt, V>
impl<Opt, V> Unpin for WeightDecay<Opt, V>
impl<Opt, V> UnsafeUnpin for WeightDecay<Opt, V>where
Opt: UnsafeUnpin,
V: UnsafeUnpin,
impl<Opt, V> UnwindSafe for WeightDecay<Opt, V>where
Opt: UnwindSafe,
V: 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