Skip to main content

TrainingObserver

Trait TrainingObserver 

Source
pub trait TrainingObserver {
    type Error: Display;

    // Required method
    fn on_step(
        &mut self,
        event: TrainingStepEvent<'_>,
    ) -> Result<(), Self::Error>;
}
Expand description

Receives one TrainingStepEvent after each successful network step.

Returning Err aborts the session before the next example is stepped. The failing step’s network update has already been applied.

This trait is generic (statically dispatched). There is no dyn call on the session hot path.

Required Associated Types§

Source

type Error: Display

Error type that aborts the session. Displayed in crate::TrainerError::Observer.

Required Methods§

Source

fn on_step(&mut self, event: TrainingStepEvent<'_>) -> Result<(), Self::Error>

Called once after a successful crate::PlasticityTrainer::train_step.

§Errors

Any error aborts the session immediately; the next example is not processed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F, E> TrainingObserver for F
where F: FnMut(TrainingStepEvent<'_>) -> Result<(), E>, E: Display,

Source§

type Error = E