pub struct GradientProcessor { /* private fields */ }Expand description
Gradient processor that applies various enhancement techniques.
Implementations§
Source§impl GradientProcessor
impl GradientProcessor
Sourcepub fn new(config: GradientProcessingConfig) -> Self
pub fn new(config: GradientProcessingConfig) -> Self
Create a new gradient processor with the given configuration.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a gradient processor with default configuration.
Sourcepub fn process_gradients(&mut self, gradients: &mut [Tensor]) -> Result<()>
pub fn process_gradients(&mut self, gradients: &mut [Tensor]) -> Result<()>
Process gradients with enabled techniques.
Sourcepub fn get_current_clip_norm(&self) -> f32
pub fn get_current_clip_norm(&self) -> f32
Get current adaptive clipping threshold.
Sourcepub fn get_current_noise_scale(&self) -> f32
pub fn get_current_noise_scale(&self) -> f32
Get current noise scale.
Sourcepub fn set_config(&mut self, config: GradientProcessingConfig)
pub fn set_config(&mut self, config: GradientProcessingConfig)
Update configuration.
Sourcepub fn get_config(&self) -> &GradientProcessingConfig
pub fn get_config(&self) -> &GradientProcessingConfig
Get current configuration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GradientProcessor
impl RefUnwindSafe for GradientProcessor
impl Send for GradientProcessor
impl Sync for GradientProcessor
impl Unpin for GradientProcessor
impl UnwindSafe for GradientProcessor
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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