pub struct GradientProcessor<A: Float> { /* private fields */ }
Expand description
Gradient clipping processor
Implementations§
Source§impl<A: Float + ScalarOperand + Debug> GradientProcessor<A>
impl<A: Float + ScalarOperand + Debug> GradientProcessor<A>
Sourcepub fn with_config(config: GradientClipConfig<A>) -> Self
pub fn with_config(config: GradientClipConfig<A>) -> Self
Create a new gradient processor with a specific configuration
Sourcepub fn set_max_value(&mut self, value: A) -> &mut Self
pub fn set_max_value(&mut self, value: A) -> &mut Self
Set max value clipping
Sourcepub fn set_min_value(&mut self, value: A) -> &mut Self
pub fn set_min_value(&mut self, value: A) -> &mut Self
Set min value clipping
Sourcepub fn set_max_norm(&mut self, value: A) -> &mut Self
pub fn set_max_norm(&mut self, value: A) -> &mut Self
Set max L2 norm clipping
Sourcepub fn set_max_l1_norm(&mut self, value: A) -> &mut Self
pub fn set_max_l1_norm(&mut self, value: A) -> &mut Self
Set max L1 norm clipping
Sourcepub fn set_centralization(&mut self, enabled: bool) -> &mut Self
pub fn set_centralization(&mut self, enabled: bool) -> &mut Self
Enable gradient centralization
Sourcepub fn set_zero_threshold(&mut self, value: A) -> &mut Self
pub fn set_zero_threshold(&mut self, value: A) -> &mut Self
Set threshold for zeroing small gradients
Sourcepub fn set_value_clip(&mut self, min: A, max: A) -> &mut Self
pub fn set_value_clip(&mut self, min: A, max: A) -> &mut Self
Set value clipping range
Sourcepub fn set_norm_clip(&mut self, max_norm: A) -> &mut Self
pub fn set_norm_clip(&mut self, max_norm: A) -> &mut Self
Set norm clipping
Sourcepub fn set_l1_norm_clip(&mut self, max_l1_norm: A) -> &mut Self
pub fn set_l1_norm_clip(&mut self, max_l1_norm: A) -> &mut Self
Set L1 norm clipping
Sourcepub fn enable_centralization(&mut self) -> &mut Self
pub fn enable_centralization(&mut self) -> &mut Self
Enable gradient centralization
Trait Implementations§
Auto Trait Implementations§
impl<A> Freeze for GradientProcessor<A>where
A: Freeze,
impl<A> RefUnwindSafe for GradientProcessor<A>where
A: RefUnwindSafe,
impl<A> Send for GradientProcessor<A>where
A: Send,
impl<A> Sync for GradientProcessor<A>where
A: Sync,
impl<A> Unpin for GradientProcessor<A>where
A: Unpin,
impl<A> UnwindSafe for GradientProcessor<A>where
A: 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
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