Skip to main content

ActivationObserver

Trait ActivationObserver 

Source
pub trait ActivationObserver<T, E> {
    // Required method
    fn observe(&mut self, path: &str, value: &T) -> Result<(), E>;

    // Provided methods
    fn intervene(&mut self, _path: &str, _value: &T) -> Result<Option<T>, E> { ... }
    fn observe_routing(
        &mut self,
        _routing: RoutingObservation<'_, T>,
    ) -> Result<(), E> { ... }
}
Expand description

Statically dispatched activation observation and intervention contract.

Required Methods§

Source

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

Observes a named backend-native tensor.

Provided Methods§

Source

fn intervene(&mut self, _path: &str, _value: &T) -> Result<Option<T>, E>

Optionally replaces an activation before it is consumed or returned.

Source

fn observe_routing( &mut self, _routing: RoutingObservation<'_, T>, ) -> Result<(), E>

Observes normalized routed-expert decisions and contributions.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, E, F> ActivationObserver<T, E> for F
where F: FnMut(&str, &T) -> Result<(), E>,

Source§

impl<T, E> ActivationObserver<T, E> for NoopObserver