pub struct ActivationStats {
pub mean: Array1<f32>,
pub variance: Array1<f32>,
pub max: Array1<f32>,
pub min: Array1<f32>,
pub sparsity: f32,
pub l2_norm: f32,
pub num_steps: usize,
/* private fields */
}Expand description
Running statistics over a sequence of activations.
Uses Welford’s online algorithm for numerically stable mean/variance.
Fields§
§mean: Array1<f32>Per-dimension mean
variance: Array1<f32>Per-dimension variance (population variance)
max: Array1<f32>Per-dimension maximum encountered value
min: Array1<f32>Per-dimension minimum encountered value
sparsity: f32Fraction of values with absolute value below eps (default 1e-6)
l2_norm: f32Global L2 norm (average over all steps)
num_steps: usizeNumber of activation vectors accumulated
Implementations§
Source§impl ActivationStats
impl ActivationStats
Sourcepub fn from_sequence(activations: &[Array1<f32>]) -> ModelResult<Self>
pub fn from_sequence(activations: &[Array1<f32>]) -> ModelResult<Self>
Compute statistics from a fixed batch of activations.
Returns an error if the slice is empty or dimensions are inconsistent.
Trait Implementations§
Source§impl Clone for ActivationStats
impl Clone for ActivationStats
Source§fn clone(&self) -> ActivationStats
fn clone(&self) -> ActivationStats
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 ActivationStats
impl RefUnwindSafe for ActivationStats
impl Send for ActivationStats
impl Sync for ActivationStats
impl Unpin for ActivationStats
impl UnsafeUnpin for ActivationStats
impl UnwindSafe for ActivationStats
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> 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