xnn.common.train.callbacks.Callback#

class xnn.common.train.callbacks.Callback[source]#

Bases: object

Base class of the trainer callbacks; override any of the hooks.

on_fit_start(trainer)[source]#

Before the first epoch.

Return type:

None

on_train_epoch_start(trainer, epoch)[source]#

Before an epoch’s training pass.

Parameters:

epoch (int)

Return type:

None

on_train_batch_end(trainer, logs, batch_idx)[source]#

After each optimizer step, with that batch’s loss terms and metrics.

Parameters:
Return type:

None

on_epoch_end(trainer, epoch, metrics)[source]#

After an epoch’s training, validation and scheduler step.

metrics holds epoch, lr, train/<key> and, on validation epochs, val/<key>. Set trainer.should_stop to end the run after this epoch.

Parameters:
Return type:

None

on_train_end(trainer)[source]#

After the last epoch, before the test evaluation.

Return type:

None

on_fit_end(trainer, results)[source]#

At the end of fit(), with its return value.

Parameters:

results (dict)

Return type:

None