Package ai.djl.training.listener
Class EpochTrainingListener
- java.lang.Object
-
- ai.djl.training.listener.TrainingListenerAdapter
-
- ai.djl.training.listener.EpochTrainingListener
-
- All Implemented Interfaces:
TrainingListener
public class EpochTrainingListener extends TrainingListenerAdapter
EpochTrainingListener
that tracks epochs.Adds "epoch" metric with epoch times and saves "epoch" model property with numEpochs
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ai.djl.training.listener.TrainingListener
TrainingListener.BatchData, TrainingListener.Defaults
-
-
Constructor Summary
Constructors Constructor Description EpochTrainingListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getNumEpochs()
Returns the number of epochs.void
onEpoch(Trainer trainer)
Listens to the end of an epoch during training.void
onTrainingBegin(Trainer trainer)
Listens to the beginning of training.void
onTrainingEnd(Trainer trainer)
Listens to the end of training.-
Methods inherited from class ai.djl.training.listener.TrainingListenerAdapter
onTrainingBatch, onValidationBatch
-
-
-
-
Method Detail
-
onEpoch
public void onEpoch(Trainer trainer)
Listens to the end of an epoch during training.- Specified by:
onEpoch
in interfaceTrainingListener
- Overrides:
onEpoch
in classTrainingListenerAdapter
- Parameters:
trainer
- the trainer the listener is attached to
-
onTrainingBegin
public void onTrainingBegin(Trainer trainer)
Listens to the beginning of training.- Specified by:
onTrainingBegin
in interfaceTrainingListener
- Overrides:
onTrainingBegin
in classTrainingListenerAdapter
- Parameters:
trainer
- the trainer the listener is attached to
-
onTrainingEnd
public void onTrainingEnd(Trainer trainer)
Listens to the end of training.- Specified by:
onTrainingEnd
in interfaceTrainingListener
- Overrides:
onTrainingEnd
in classTrainingListenerAdapter
- Parameters:
trainer
- the trainer the listener is attached to
-
getNumEpochs
public int getNumEpochs()
Returns the number of epochs.- Returns:
- the number of epochs
-
-