pub trait Callback {
// Provided methods
fn on_train_begin(&mut self, _state: &TrainingState) -> TrainResult<()> { ... }
fn on_train_end(&mut self, _state: &TrainingState) -> TrainResult<()> { ... }
fn on_epoch_begin(
&mut self,
_epoch: usize,
_state: &TrainingState,
) -> TrainResult<()> { ... }
fn on_epoch_end(
&mut self,
_epoch: usize,
_state: &TrainingState,
) -> TrainResult<()> { ... }
fn on_batch_begin(
&mut self,
_batch: usize,
_state: &TrainingState,
) -> TrainResult<()> { ... }
fn on_batch_end(
&mut self,
_batch: usize,
_state: &TrainingState,
) -> TrainResult<()> { ... }
fn on_validation_end(&mut self, _state: &TrainingState) -> TrainResult<()> { ... }
fn should_stop(&self) -> bool { ... }
}Expand description
Trait for training callbacks.
Provided Methods§
Sourcefn on_train_begin(&mut self, _state: &TrainingState) -> TrainResult<()>
fn on_train_begin(&mut self, _state: &TrainingState) -> TrainResult<()>
Called at the beginning of training.
Sourcefn on_train_end(&mut self, _state: &TrainingState) -> TrainResult<()>
fn on_train_end(&mut self, _state: &TrainingState) -> TrainResult<()>
Called at the end of training.
Sourcefn on_epoch_begin(
&mut self,
_epoch: usize,
_state: &TrainingState,
) -> TrainResult<()>
fn on_epoch_begin( &mut self, _epoch: usize, _state: &TrainingState, ) -> TrainResult<()>
Called at the beginning of an epoch.
Sourcefn on_epoch_end(
&mut self,
_epoch: usize,
_state: &TrainingState,
) -> TrainResult<()>
fn on_epoch_end( &mut self, _epoch: usize, _state: &TrainingState, ) -> TrainResult<()>
Called at the end of an epoch.
Sourcefn on_batch_begin(
&mut self,
_batch: usize,
_state: &TrainingState,
) -> TrainResult<()>
fn on_batch_begin( &mut self, _batch: usize, _state: &TrainingState, ) -> TrainResult<()>
Called at the beginning of a batch.
Sourcefn on_batch_end(
&mut self,
_batch: usize,
_state: &TrainingState,
) -> TrainResult<()>
fn on_batch_end( &mut self, _batch: usize, _state: &TrainingState, ) -> TrainResult<()>
Called at the end of a batch.
Sourcefn on_validation_end(&mut self, _state: &TrainingState) -> TrainResult<()>
fn on_validation_end(&mut self, _state: &TrainingState) -> TrainResult<()>
Called after validation.
Sourcefn should_stop(&self) -> bool
fn should_stop(&self) -> bool
Check if training should stop early.