pub struct MixedPrecisionTrainer { /* private fields */ }Expand description
Mixed precision training manager with automatic loss scaling
Implementations§
Source§impl MixedPrecisionTrainer
impl MixedPrecisionTrainer
Sourcepub fn new(
tensor_core_info: TensorCoreInfo,
config: &TensorCoreConfig,
) -> Result<Self, GpuOptimError>
pub fn new( tensor_core_info: TensorCoreInfo, config: &TensorCoreConfig, ) -> Result<Self, GpuOptimError>
Create new mixed precision trainer
Sourcepub fn update_loss_scale(&mut self, hasoverflow: bool)
pub fn update_loss_scale(&mut self, hasoverflow: bool)
Update loss scale based on gradient overflow detection
Sourcepub fn get_loss_scale(&self) -> f32
pub fn get_loss_scale(&self) -> f32
Get current loss scale
Sourcepub fn select_optimal_precision(
&self,
operation_type: TensorCoreOperationType,
) -> TensorCorePrecision
pub fn select_optimal_precision( &self, operation_type: TensorCoreOperationType, ) -> TensorCorePrecision
Select optimal precision for current operation
Sourcepub fn get_statistics(&self) -> MixedPrecisionStats
pub fn get_statistics(&self) -> MixedPrecisionStats
Get training statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MixedPrecisionTrainer
impl RefUnwindSafe for MixedPrecisionTrainer
impl Send for MixedPrecisionTrainer
impl Sync for MixedPrecisionTrainer
impl Unpin for MixedPrecisionTrainer
impl UnsafeUnpin for MixedPrecisionTrainer
impl UnwindSafe for MixedPrecisionTrainer
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