Skip to main content

CaptureObserver

Struct CaptureObserver 

Source
pub struct CaptureObserver<'a, B, F> { /* private fields */ }
Expand description

Borrows the existing capture owner. Backends provide native primitives and a typed error conversion; this adapter owns no completion or native recovery state.

Implementations§

Source§

impl<'a, B, F> CaptureObserver<'a, B, F>

Source

pub fn new(session: &'a mut CaptureSession, backend: B, map_error: F) -> Self

Creates an observer that forwards all value/control hooks to the shared run.

Trait Implementations§

Source§

impl<B, E, F> ActivationObserver<<B as CaptureBackend>::Tensor, E> for CaptureObserver<'_, B, F>

Source§

fn observe(&mut self, path: &str, value: &B::Tensor) -> Result<(), E>

Observes a named backend-native tensor.
Source§

fn intervene( &mut self, path: &str, value: &B::Tensor, ) -> Result<Option<B::Tensor>, E>

Optionally replaces an activation before it is consumed or returned.
Source§

fn routing_control( &mut self, path: &str, rows: u64, ) -> Result<Option<GroupSelectionControl>, E>

Obtains a validated control before the selector dispatches any experts. The default ordinary path allocates and materializes nothing.
Source§

fn routing_applied( &mut self, path: &str, original: Option<RoutingDecision<'_, B::Tensor>>, effective: RoutingDecision<'_, B::Tensor>, ) -> Result<(), E>

Receives original/effective decisions before they reach the expert provider.
Source§

fn routing_failed(&mut self, path: &str, message: &str)

Records a failed control under the enclosing forward pass’s failure owner.
Source§

fn finish(&mut self) -> Result<(), E>

Completes an ordinary forward pass under its existing failure owner. Scheduled-but-missing interventions must fail before prediction commitment.
Source§

fn observe_routing( &mut self, routing: RoutingObservation<'_, B::Tensor>, ) -> Result<(), E>

Observes normalized routed-expert decisions and contributions.

Auto Trait Implementations§

§

impl<'a, B, F> !RefUnwindSafe for CaptureObserver<'a, B, F>

§

impl<'a, B, F> !UnwindSafe for CaptureObserver<'a, B, F>

§

impl<'a, B, F> Freeze for CaptureObserver<'a, B, F>
where B: Freeze, F: Freeze,

§

impl<'a, B, F> Send for CaptureObserver<'a, B, F>
where B: Send, F: Send,

§

impl<'a, B, F> Sync for CaptureObserver<'a, B, F>
where B: Sync, F: Sync,

§

impl<'a, B, F> Unpin for CaptureObserver<'a, B, F>
where B: Unpin, F: Unpin,

§

impl<'a, B, F> UnsafeUnpin for CaptureObserver<'a, B, F>
where B: UnsafeUnpin, F: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.