pub struct GradientVerifier;Expand description
Gradient verification utilities
Implementations§
Source§impl GradientVerifier
impl GradientVerifier
Sourcepub fn verify_shape(
gradient: &[f32],
expected_shape: &[usize],
) -> Result<(), GradientError>
pub fn verify_shape( gradient: &[f32], expected_shape: &[usize], ) -> Result<(), GradientError>
Verify gradient shape matches expected shape
Sourcepub fn detect_outliers(
gradient: &[f32],
std_threshold: f32,
) -> Result<(), GradientError>
pub fn detect_outliers( gradient: &[f32], std_threshold: f32, ) -> Result<(), GradientError>
Detect outliers in gradient (values beyond threshold standard deviations)
Sourcepub fn verify_finite(gradient: &[f32]) -> Result<(), GradientError>
pub fn verify_finite(gradient: &[f32]) -> Result<(), GradientError>
Verify gradient is not NaN or Inf
Sourcepub fn clip_by_norm(gradient: &mut [f32], max_norm: f32)
pub fn clip_by_norm(gradient: &mut [f32], max_norm: f32)
Clip gradient by norm
Auto Trait Implementations§
impl Freeze for GradientVerifier
impl RefUnwindSafe for GradientVerifier
impl Send for GradientVerifier
impl Sync for GradientVerifier
impl Unpin for GradientVerifier
impl UnwindSafe for GradientVerifier
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