pub struct GradientStats {
pub layer_name: String,
pub norm: f64,
pub mean: f64,
pub std: f64,
pub max_abs: f64,
}Expand description
Gradient statistics for monitoring gradient flow.
Fields§
§layer_name: StringLayer name
norm: f64L2 norm of gradients
mean: f64Mean gradient value
std: f64Standard deviation of gradients
max_abs: f64Maximum absolute gradient
Implementations§
Source§impl GradientStats
impl GradientStats
Sourcepub fn compute(layer_name: String, grads: &Array1<f64>) -> Self
pub fn compute(layer_name: String, grads: &Array1<f64>) -> Self
Compute gradient statistics from a gradient array.
Sourcepub fn is_vanishing(&self, threshold: f64) -> bool
pub fn is_vanishing(&self, threshold: f64) -> bool
Check if gradients are vanishing (too small).
Sourcepub fn is_exploding(&self, threshold: f64) -> bool
pub fn is_exploding(&self, threshold: f64) -> bool
Check if gradients are exploding (too large).
Trait Implementations§
Source§impl Clone for GradientStats
impl Clone for GradientStats
Source§fn clone(&self) -> GradientStats
fn clone(&self) -> GradientStats
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GradientStats
impl RefUnwindSafe for GradientStats
impl Send for GradientStats
impl Sync for GradientStats
impl Unpin for GradientStats
impl UnwindSafe for GradientStats
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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