public class MemoryTrainingListener extends java.lang.Object implements TrainingListener
TrainingListener that collects the memory usage information.
If an outputDir is provided, the file "$outputDir/memory.log" will be created after training with the memory usage results.
TrainingListener.BatchData, TrainingListener.Defaults| Constructor and Description |
|---|
MemoryTrainingListener()
Constructs a
MemoryTrainingListener that does not output data to a file. |
MemoryTrainingListener(java.lang.String outputDir)
Constructs a
MemoryTrainingListener that outputs data in the given directory. |
| Modifier and Type | Method and Description |
|---|---|
static void |
collectMemoryInfo(Metrics metrics)
Collect memory information.
|
static void |
dumpMemoryInfo(Metrics metrics,
java.lang.String logDir)
Dump memory metrics into log directory.
|
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 |
onTrainingBegin(Trainer trainer)
Listens to the beginning of 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.
|
public MemoryTrainingListener()
MemoryTrainingListener that does not output data to a file.public MemoryTrainingListener(java.lang.String outputDir)
MemoryTrainingListener that outputs data in the given directory.outputDir - the directory to output the tracked memory data inpublic void onEpoch(Trainer trainer)
onEpoch in interface TrainingListenertrainer - the trainer the listener is attached topublic void onTrainingBatch(Trainer trainer, TrainingListener.BatchData batchData)
onTrainingBatch in interface TrainingListenertrainer - the trainer the listener is attached tobatchData - the data from the batchpublic void onValidationBatch(Trainer trainer, TrainingListener.BatchData batchData)
onValidationBatch in interface TrainingListenertrainer - the trainer the listener is attached tobatchData - the data from the batchpublic void onTrainingBegin(Trainer trainer)
onTrainingBegin in interface TrainingListenertrainer - the trainer the listener is attached topublic void onTrainingEnd(Trainer trainer)
onTrainingEnd in interface TrainingListenertrainer - the trainer the listener is attached topublic static void collectMemoryInfo(Metrics metrics)
metrics - Metrics to store memory informationpublic static void dumpMemoryInfo(Metrics metrics, java.lang.String logDir)
metrics - metrics contains memory informationlogDir - output log directory