Realm

oa::ml::optim::GradScaler

Struct published by the oa::ml::optim module.

StRust public API

Declaration

pub struct GradScaler { /* private fields */ }
Public Rust declaration.

Public Methods

pub fn scale(&self) -> f32
pub fn capture_state(&self) -> Result<GradScalerState>
pub fn restore_state(&mut self, state: GradScalerState) -> Result<()>
pub fn prepare_captured(&mut self, runtime: &Runtime) -> Result<()>
pub fn finite_flag(&self) -> Result<Matrix>
pub fn record_finite_gate(&mut self, check: &Matrix) -> Result<()>
pub fn scale_loss(&self, loss: &Matrix) -> Result<Matrix>
pub fn unscale_gradients(&self, parameters: &[Parameter]) -> Result<Matrix>
pub fn step_optimizer( &mut self, optimizer: &mut dyn Optimizer, check: &Matrix, ) -> Result<bool>
pub fn update(&mut self)
pub fn device_scale(&self) -> Result<f32>
fn clone(&self) -> GradScaler

Associated Functions

pub fn new() -> Self
pub fn with_config( init_scale: f32, growth_factor: f32, backoff_factor: f32, growth_interval: u64, ) -> Result<Self>
fn default() -> Self

Public Method Documentation

pub fn scale( &self ) -> f32
No public source comment is attached to this declaration.
pub fn capture_state( &self ) -> Result<GradScalerState>
No public source comment is attached to this declaration.
pub fn restore_state(&mut self, state: GradScalerState) -> Result<()>
No public source comment is attached to this declaration.
pub fn prepare_captured(&mut self, runtime: &Runtime) -> Result<()>
No public source comment is attached to this declaration.
pub fn finite_flag( &self ) -> Result<Matrix>
No public source comment is attached to this declaration.
pub fn record_finite_gate(&mut self, check: &Matrix) -> Result<()>
No public source comment is attached to this declaration.
pub fn scale_loss( &self, loss: &Matrix ) -> Result<Matrix>
No public source comment is attached to this declaration.
pub fn unscale_gradients( &self, parameters: &[Parameter] ) -> Result<Matrix>
No public source comment is attached to this declaration.
pub fn step_optimizer( &mut self, optimizer: &mut dyn Optimizer, check: &Matrix ) -> Result<bool>
No public source comment is attached to this declaration.
pub fn update( &mut self )
No public source comment is attached to this declaration.
pub fn device_scale( &self ) -> Result<f32>
No public source comment is attached to this declaration.
fn clone( &self ) -> GradScaler
No public source comment is attached to this declaration.
pub fn new() -> Self
No public source comment is attached to this declaration.
pub fn with_config( init_scale: f32, growth_factor: f32, backoff_factor: f32, growth_interval: u64 ) -> Result<Self>
No public source comment is attached to this declaration.
fn default() -> Self
No public source comment is attached to this declaration.