pub struct SparsePatternTracker {
pub parameter_id: String,
pub pattern_history: VecDeque<HashSet<usize>>,
pub max_history: usize,
pub stable_sparse_indices: HashSet<usize>,
pub stable_dense_indices: HashSet<usize>,
pub stability_threshold: f32,
}Expand description
Sparse pattern tracker for analyzing sparsity patterns over time
Fields§
§parameter_id: StringParameter ID
pattern_history: VecDeque<HashSet<usize>>Historical sparsity patterns (indices of non-zero elements)
max_history: usizeMaximum history length
stable_sparse_indices: HashSet<usize>Stable sparse indices (consistently sparse)
stable_dense_indices: HashSet<usize>Stable dense indices (consistently non-zero)
stability_threshold: f32Stability threshold (fraction of history where pattern must be consistent)
Implementations§
Source§impl SparsePatternTracker
impl SparsePatternTracker
Sourcepub fn new(
parameter_id: String,
max_history: usize,
stability_threshold: f32,
) -> Self
pub fn new( parameter_id: String, max_history: usize, stability_threshold: f32, ) -> Self
Create a new pattern tracker
Sourcepub fn update(&mut self, sparse_gradient: &SparseGradient)
pub fn update(&mut self, sparse_gradient: &SparseGradient)
Update with a new sparse pattern
Sourcepub fn get_statistics(&self) -> SparsePatternStatistics
pub fn get_statistics(&self) -> SparsePatternStatistics
Get sparsity statistics
Sourcepub fn is_consistently_sparse(&self, index: usize) -> bool
pub fn is_consistently_sparse(&self, index: usize) -> bool
Check if an index is consistently sparse
Sourcepub fn is_consistently_dense(&self, index: usize) -> bool
pub fn is_consistently_dense(&self, index: usize) -> bool
Check if an index is consistently dense
Trait Implementations§
Source§impl Clone for SparsePatternTracker
impl Clone for SparsePatternTracker
Source§fn clone(&self) -> SparsePatternTracker
fn clone(&self) -> SparsePatternTracker
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SparsePatternTracker
impl RefUnwindSafe for SparsePatternTracker
impl Send for SparsePatternTracker
impl Sync for SparsePatternTracker
impl Unpin for SparsePatternTracker
impl UnsafeUnpin for SparsePatternTracker
impl UnwindSafe for SparsePatternTracker
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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