pub struct AdamUtils;Expand description
Common utilities for Adam-based optimizers Adam系最適化器の共通ユーティリティ
Implementations§
Source§impl AdamUtils
impl AdamUtils
Sourcepub fn apply_weight_decay(
grad: &Tensor<f32>,
param: &Tensor<f32>,
weight_decay: f32,
) -> Tensor<f32>
pub fn apply_weight_decay( grad: &Tensor<f32>, param: &Tensor<f32>, weight_decay: f32, ) -> Tensor<f32>
Apply weight decay to gradient 勾配に重み減衰を適用
Sourcepub fn update_momentum(
momentum: &mut Tensor<f32>,
grad: &Tensor<f32>,
beta1: f32,
)
pub fn update_momentum( momentum: &mut Tensor<f32>, grad: &Tensor<f32>, beta1: f32, )
Update momentum (first moment) モーメンタム(第一モーメント)を更新
Sourcepub fn update_velocity(
velocity: &mut Tensor<f32>,
grad: &Tensor<f32>,
beta2: f32,
)
pub fn update_velocity( velocity: &mut Tensor<f32>, grad: &Tensor<f32>, beta2: f32, )
Update velocity (second moment) ベロシティ(第二モーメント)を更新
Sourcepub fn bias_correction1(beta1: f32, step: usize) -> f32
pub fn bias_correction1(beta1: f32, step: usize) -> f32
Compute bias correction for first moment 第一モーメントのバイアス補正を計算
Sourcepub fn bias_correction2(beta2: f32, step: usize) -> f32
pub fn bias_correction2(beta2: f32, step: usize) -> f32
Compute bias correction for second moment
第二モーメントのバイアス補正を計算
Sourcepub fn apply_bias_correction(
tensor: &Tensor<f32>,
correction: f32,
) -> Tensor<f32>
pub fn apply_bias_correction( tensor: &Tensor<f32>, correction: f32, ) -> Tensor<f32>
Apply bias correction to tensor テンソルにバイアス補正を適用
Auto Trait Implementations§
impl Freeze for AdamUtils
impl RefUnwindSafe for AdamUtils
impl Send for AdamUtils
impl Sync for AdamUtils
impl Unpin for AdamUtils
impl UnwindSafe for AdamUtils
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