pub struct GatingAnalysis {
pub gate_values: Vec<Array1<f32>>,
pub avg_gate: Array1<f32>,
pub dead_gates: Vec<usize>,
pub saturated_gates: Vec<usize>,
pub gate_entropy: f32,
}Expand description
Analysis of gating patterns in gated models (RWKV, Mamba, etc.).
Fields§
§gate_values: Vec<Array1<f32>>All captured gate activation vectors (one per step)
avg_gate: Array1<f32>Average gate value per unit, across all steps
dead_gates: Vec<usize>Indices of “dead” gates: average value below threshold
saturated_gates: Vec<usize>Indices of “saturated” gates: average value above 1 - threshold
gate_entropy: f32Shannon entropy of the average gate distribution (treating avg_gate as unnormalised probs)
Implementations§
Source§impl GatingAnalysis
impl GatingAnalysis
Sourcepub fn from_activations(
gate_values: Vec<Array1<f32>>,
threshold: f32,
) -> ModelResult<Self>
pub fn from_activations( gate_values: Vec<Array1<f32>>, threshold: f32, ) -> ModelResult<Self>
Analyse the given gate activations.
§Parameters
gate_values— oneArray1<f32>per time-step; all must have the same lengththreshold— gates with avg < threshold are “dead”; avg > 1 - threshold are “saturated”
Sourcepub fn effective_capacity(&self) -> f32
pub fn effective_capacity(&self) -> f32
Fraction of gates that are neither dead nor saturated (effective gates).
Trait Implementations§
Source§impl Clone for GatingAnalysis
impl Clone for GatingAnalysis
Source§fn clone(&self) -> GatingAnalysis
fn clone(&self) -> GatingAnalysis
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 GatingAnalysis
impl RefUnwindSafe for GatingAnalysis
impl Send for GatingAnalysis
impl Sync for GatingAnalysis
impl Unpin for GatingAnalysis
impl UnsafeUnpin for GatingAnalysis
impl UnwindSafe for GatingAnalysis
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