pub struct HookManager { /* private fields */ }Expand description
Hook manager for coordinating debugging hooks
Implementations§
Source§impl HookManager
impl HookManager
Sourcepub fn register_hook(&mut self, config: HookConfig) -> Result<Uuid>
pub fn register_hook(&mut self, config: HookConfig) -> Result<Uuid>
Register a new hook
Sourcepub fn register_callback(&mut self, name: String, callback: HookCallback)
pub fn register_callback(&mut self, name: String, callback: HookCallback)
Register a custom callback
Sourcepub fn remove_hook(&mut self, hook_id: Uuid) -> Option<HookConfig>
pub fn remove_hook(&mut self, hook_id: Uuid) -> Option<HookConfig>
Remove a hook
Sourcepub fn set_hook_enabled(&mut self, hook_id: Uuid, enabled: bool) -> Result<()>
pub fn set_hook_enabled(&mut self, hook_id: Uuid, enabled: bool) -> Result<()>
Enable/disable a specific hook
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable/disable all hooks
Sourcepub fn execute_hooks<T>(
&mut self,
layer_name: &str,
tensor_data: &[T],
tensor_shape: &[usize],
is_forward: bool,
metadata: Option<HashMap<String, String>>,
) -> Vec<(Uuid, HookResult)>where
T: Clone + 'static,
pub fn execute_hooks<T>(
&mut self,
layer_name: &str,
tensor_data: &[T],
tensor_shape: &[usize],
is_forward: bool,
metadata: Option<HashMap<String, String>>,
) -> Vec<(Uuid, HookResult)>where
T: Clone + 'static,
Execute hooks for a tensor operation
Sourcepub fn get_hook(&self, hook_id: Uuid) -> Option<&HookConfig>
pub fn get_hook(&self, hook_id: Uuid) -> Option<&HookConfig>
Get hook configuration
Sourcepub fn get_all_hooks(&self) -> Vec<&HookConfig>
pub fn get_all_hooks(&self) -> Vec<&HookConfig>
Get all hooks
Sourcepub fn get_hook_stats(&self, hook_id: Uuid) -> Option<&HookStats>
pub fn get_hook_stats(&self, hook_id: Uuid) -> Option<&HookStats>
Get hook statistics
Sourcepub fn get_all_stats(&self) -> Vec<&HookStats>
pub fn get_all_stats(&self) -> Vec<&HookStats>
Get all hook statistics
Sourcepub fn clear_hooks(&mut self)
pub fn clear_hooks(&mut self)
Clear all hooks
Sourcepub fn create_tensor_inspection_hook(
&mut self,
layer_patterns: Vec<String>,
) -> Result<Uuid>
pub fn create_tensor_inspection_hook( &mut self, layer_patterns: Vec<String>, ) -> Result<Uuid>
Create a convenient tensor inspection hook
Sourcepub fn create_gradient_tracking_hook(
&mut self,
layer_patterns: Vec<String>,
) -> Result<Uuid>
pub fn create_gradient_tracking_hook( &mut self, layer_patterns: Vec<String>, ) -> Result<Uuid>
Create a gradient tracking hook
Sourcepub fn create_alert_hook(
&mut self,
condition: HookCondition,
message: String,
severity: AlertSeverity,
) -> Result<Uuid>
pub fn create_alert_hook( &mut self, condition: HookCondition, message: String, severity: AlertSeverity, ) -> Result<Uuid>
Create a conditional alert hook
Trait Implementations§
Source§impl Debug for HookManager
impl Debug for HookManager
Auto Trait Implementations§
impl Freeze for HookManager
impl !RefUnwindSafe for HookManager
impl Send for HookManager
impl Sync for HookManager
impl Unpin for HookManager
impl !UnwindSafe for HookManager
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> 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 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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.