Skip to main content

TrainingCallback

Trait TrainingCallback 

Source
pub trait TrainingCallback {
    // Required method
    fn on_epoch_end(
        &mut self,
        epoch: usize,
        metrics: &HashMap<String, f32>,
    ) -> bool;

    // Provided method
    fn on_batch_end(&mut self, _epoch: usize, _batch: usize, _loss: f32) { ... }
}
Expand description

Trait for training callbacks invoked after each epoch.

Required Methods§

Source

fn on_epoch_end(&mut self, epoch: usize, metrics: &HashMap<String, f32>) -> bool

Called after each epoch. Returns true if training should stop.

Provided Methods§

Source

fn on_batch_end(&mut self, _epoch: usize, _batch: usize, _loss: f32)

Called after each batch within an epoch. Default implementation does nothing.

Implementors§