pub struct LayerProbe { /* private fields */ }Expand description
Ring-buffer probe for capturing intermediate layer outputs.
When enabled, each call to LayerProbe::capture stores the activation.
The buffer is bounded to max_capture entries; older entries are overwritten.
Implementations§
Source§impl LayerProbe
impl LayerProbe
Sourcepub fn new(layer_name: &str, max_capture: usize) -> Self
pub fn new(layer_name: &str, max_capture: usize) -> Self
Create a new probe for layer_name that holds up to max_capture activations.
Sourcepub fn capture(&mut self, activation: Array1<f32>)
pub fn capture(&mut self, activation: Array1<f32>)
Capture one activation vector. No-op if disabled.
Sourcepub fn stats(&self) -> ModelResult<ActivationStats>
pub fn stats(&self) -> ModelResult<ActivationStats>
Compute statistics over all captured activations.
Sourcepub fn activations(&self) -> &[Array1<f32>] ⓘ
pub fn activations(&self) -> &[Array1<f32>] ⓘ
Read all captured activations (in capture order if not wrapped, otherwise ring order).
Sourcepub fn layer_name(&self) -> &str
pub fn layer_name(&self) -> &str
Return the layer name associated with this probe.
Auto Trait Implementations§
impl Freeze for LayerProbe
impl RefUnwindSafe for LayerProbe
impl Send for LayerProbe
impl Sync for LayerProbe
impl Unpin for LayerProbe
impl UnsafeUnpin for LayerProbe
impl UnwindSafe for LayerProbe
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 more