public class TimeMeasureTrainingListener extends TrainingListenerAdapter
TrainingListener
that outputs the training time metrics after training is done.
The training time data is placed in the file "$outputDir/training.log" and the validation data is placed in "$outputDir/validate.log".
TrainingListener.BatchData, TrainingListener.Defaults
Constructor and Description |
---|
TimeMeasureTrainingListener(java.lang.String outputDir)
Constructs a
TimeMeasureTrainingListener . |
Modifier and Type | Method and Description |
---|---|
void |
onEpoch(Trainer trainer)
Listens to the end of an epoch during training.
|
void |
onTrainingBatch(Trainer trainer,
TrainingListener.BatchData batchData)
Listens to the end of training one batch of data during training.
|
void |
onTrainingEnd(Trainer trainer)
Listens to the end of training.
|
void |
onValidationBatch(Trainer trainer,
TrainingListener.BatchData batchData)
Listens to the end of validating one batch of data during validation.
|
onTrainingBegin
public TimeMeasureTrainingListener(java.lang.String outputDir)
TimeMeasureTrainingListener
.outputDir
- the directory to output the tracked timing data inpublic void onEpoch(Trainer trainer)
onEpoch
in interface TrainingListener
onEpoch
in class TrainingListenerAdapter
trainer
- the trainer the listener is attached topublic void onTrainingBatch(Trainer trainer, TrainingListener.BatchData batchData)
onTrainingBatch
in interface TrainingListener
onTrainingBatch
in class TrainingListenerAdapter
trainer
- the trainer the listener is attached tobatchData
- the data from the batchpublic void onValidationBatch(Trainer trainer, TrainingListener.BatchData batchData)
onValidationBatch
in interface TrainingListener
onValidationBatch
in class TrainingListenerAdapter
trainer
- the trainer the listener is attached tobatchData
- the data from the batchpublic void onTrainingEnd(Trainer trainer)
onTrainingEnd
in interface TrainingListener
onTrainingEnd
in class TrainingListenerAdapter
trainer
- the trainer the listener is attached to