pub struct AnomalyDetector { /* private fields */ }Expand description
Anomaly detector for model execution
Implementations§
Source§impl AnomalyDetector
impl AnomalyDetector
Sourcepub fn new(_config: &DebugConfig) -> Self
pub fn new(_config: &DebugConfig) -> Self
Create a new anomaly detector
Sourcepub fn check_nan(&mut self, values: &[f32], location: &str) -> Result<()>
pub fn check_nan(&mut self, values: &[f32], location: &str) -> Result<()>
Check for NaN values in tensors
Sourcepub fn check_inf(&mut self, values: &[f32], location: &str) -> Result<()>
pub fn check_inf(&mut self, values: &[f32], location: &str) -> Result<()>
Check for infinite values in tensors
Sourcepub fn check_gradient_explosion(
&mut self,
gradient_norm: f64,
location: &str,
) -> Result<()>
pub fn check_gradient_explosion( &mut self, gradient_norm: f64, location: &str, ) -> Result<()>
Check for gradient explosion
Sourcepub fn check_gradient_vanishing(
&mut self,
gradient_norm: f64,
location: &str,
) -> Result<()>
pub fn check_gradient_vanishing( &mut self, gradient_norm: f64, location: &str, ) -> Result<()>
Check for vanishing gradients
Sourcepub fn check_numerical_instability(
&mut self,
values: &[f32],
location: &str,
) -> Result<()>
pub fn check_numerical_instability( &mut self, values: &[f32], location: &str, ) -> Result<()>
Check for numerical instability
Sourcepub fn check_activation_saturation(
&mut self,
activations: &[f32],
activation_type: &str,
location: &str,
) -> Result<()>
pub fn check_activation_saturation( &mut self, activations: &[f32], activation_type: &str, location: &str, ) -> Result<()>
Check for activation saturation
Sourcepub fn check_memory_leak(
&mut self,
current_memory_mb: usize,
expected_memory_mb: Option<usize>,
location: &str,
) -> Result<()>
pub fn check_memory_leak( &mut self, current_memory_mb: usize, expected_memory_mb: Option<usize>, location: &str, ) -> Result<()>
Check for memory leaks by tracking memory usage patterns
Sourcepub fn check_weight_explosion(
&mut self,
weights: &[f32],
layer_name: &str,
) -> Result<()>
pub fn check_weight_explosion( &mut self, weights: &[f32], layer_name: &str, ) -> Result<()>
Check for weight explosion in model parameters
Sourcepub fn get_anomalies(&self) -> &[Anomaly]
pub fn get_anomalies(&self) -> &[Anomaly]
Get all detected anomalies
Sourcepub fn clear_anomalies(&mut self)
pub fn clear_anomalies(&mut self)
Clear all detected anomalies
Sourcepub fn check_gradient_conflict(
&mut self,
layer_gradients: &HashMap<String, Vec<f32>>,
) -> Result<()>
pub fn check_gradient_conflict( &mut self, layer_gradients: &HashMap<String, Vec<f32>>, ) -> Result<()>
Check for gradient conflicts between layers
Sourcepub fn check_weight_divergence(
&mut self,
layer_name: &str,
current_weights: &[f32],
) -> Result<()>
pub fn check_weight_divergence( &mut self, layer_name: &str, current_weights: &[f32], ) -> Result<()>
Check for weight divergence from baseline
Sourcepub fn check_performance_degradation(
&mut self,
current_performance: f64,
location: &str,
) -> Result<()>
pub fn check_performance_degradation( &mut self, current_performance: f64, location: &str, ) -> Result<()>
Check for performance degradation
Sourcepub fn check_loss_anomaly(
&mut self,
current_loss: f64,
location: &str,
) -> Result<()>
pub fn check_loss_anomaly( &mut self, current_loss: f64, location: &str, ) -> Result<()>
Check for loss anomalies
Sourcepub async fn attempt_recovery(
&mut self,
anomaly: &Anomaly,
) -> Result<RecoveryAction>
pub async fn attempt_recovery( &mut self, anomaly: &Anomaly, ) -> Result<RecoveryAction>
Attempt automatic recovery from an anomaly
Sourcepub fn get_monitoring_stats(&self) -> &MonitoringStats
pub fn get_monitoring_stats(&self) -> &MonitoringStats
Get monitoring statistics
Sourcepub fn get_recovery_attempts(&self) -> &[RecoveryAttempt]
pub fn get_recovery_attempts(&self) -> &[RecoveryAttempt]
Get recovery attempts history
Sourcepub fn update_monitoring_window(&mut self) -> Result<()>
pub fn update_monitoring_window(&mut self) -> Result<()>
Update monitoring window with current state
Sourcepub async fn quick_check(&self) -> Result<QuickAnomalySummary>
pub async fn quick_check(&self) -> Result<QuickAnomalySummary>
Quick anomaly check for simplified interface
Sourcepub async fn generate_report(&self) -> Result<AnomalyDetectorReport>
pub async fn generate_report(&self) -> Result<AnomalyDetectorReport>
Generate anomaly detection report
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AnomalyDetector
impl RefUnwindSafe for AnomalyDetector
impl Send for AnomalyDetector
impl Sync for AnomalyDetector
impl Unpin for AnomalyDetector
impl UnsafeUnpin for AnomalyDetector
impl UnwindSafe for AnomalyDetector
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
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.