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§
Sourcetype Error: Display
type Error: Display
Error type that aborts the session. Displayed in crate::TrainerError::Observer.
Required Methods§
Sourcefn on_step(&mut self, event: TrainingStepEvent<'_>) -> Result<(), Self::Error>
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".