Class SleepyTrainingListener
- java.lang.Object
-
- org.deeplearning4j.optimize.api.BaseTrainingListener
-
- org.deeplearning4j.optimize.listeners.SleepyTrainingListener
-
- All Implemented Interfaces:
Serializable,TrainingListener
public class SleepyTrainingListener extends BaseTrainingListener implements Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSleepyTrainingListener.SleepModestatic classSleepyTrainingListener.TimeMode
-
Field Summary
Fields Modifier and Type Field Description protected ThreadLocal<AtomicLong>lastBPprotected ThreadLocal<AtomicLong>lastEEprotected ThreadLocal<AtomicLong>lastESprotected ThreadLocal<AtomicLong>lastFFprotected ThreadLocal<AtomicLong>lastIterationprotected SleepyTrainingListener.SleepModesleepModeprotected SleepyTrainingListener.TimeModetimeModeprotected longtimerBPprotected longtimerEEprotected longtimerESprotected longtimerFFprotected longtimerIteration
-
Constructor Summary
Constructors Constructor Description SleepyTrainingListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiditerationDone(Model model, int iteration, int epoch)Event listener for each iteration.voidonBackwardPass(Model model)Called once per iteration (backward pass) after gradients have been calculated, and updated Gradients are available viaModel.gradient().voidonEpochEnd(Model model)Called once at the end of each epoch, when using methods such asMultiLayerNetwork.fit(DataSetIterator),ComputationGraph.fit(DataSetIterator)orComputationGraph.fit(MultiDataSetIterator)voidonEpochStart(Model model)Called once at the start of each epoch, when using methods such asMultiLayerNetwork.fit(DataSetIterator),ComputationGraph.fit(DataSetIterator)orComputationGraph.fit(MultiDataSetIterator)voidonForwardPass(Model model, List<INDArray> activations)Called once per iteration (forward pass) for activations (usually for aMultiLayerNetwork), only at training timevoidonForwardPass(Model model, Map<String,INDArray> activations)Called once per iteration (forward pass) for activations (usually for aComputationGraph), only at training timevoidonGradientCalculation(Model model)Called once per iteration (backward pass) before the gradients are updated Gradients are available viaModel.gradient().protected voidsleep(long sleepTimeMs)protected voidsleep(AtomicLong lastTime, long sleepTime)
-
-
-
Field Detail
-
lastEE
protected final transient ThreadLocal<AtomicLong> lastEE
-
lastES
protected final transient ThreadLocal<AtomicLong> lastES
-
lastFF
protected final transient ThreadLocal<AtomicLong> lastFF
-
lastBP
protected final transient ThreadLocal<AtomicLong> lastBP
-
lastIteration
protected final transient ThreadLocal<AtomicLong> lastIteration
-
timerEE
protected long timerEE
-
timerES
protected long timerES
-
timerFF
protected long timerFF
-
timerBP
protected long timerBP
-
timerIteration
protected long timerIteration
-
sleepMode
protected SleepyTrainingListener.SleepMode sleepMode
-
timeMode
protected SleepyTrainingListener.TimeMode timeMode
-
-
Method Detail
-
sleep
protected void sleep(long sleepTimeMs)
-
sleep
protected void sleep(AtomicLong lastTime, long sleepTime)
-
onEpochStart
public void onEpochStart(Model model)
Description copied from interface:TrainingListenerCalled once at the start of each epoch, when using methods such asMultiLayerNetwork.fit(DataSetIterator),ComputationGraph.fit(DataSetIterator)orComputationGraph.fit(MultiDataSetIterator)- Specified by:
onEpochStartin interfaceTrainingListener- Overrides:
onEpochStartin classBaseTrainingListener
-
onEpochEnd
public void onEpochEnd(Model model)
Description copied from interface:TrainingListenerCalled once at the end of each epoch, when using methods such asMultiLayerNetwork.fit(DataSetIterator),ComputationGraph.fit(DataSetIterator)orComputationGraph.fit(MultiDataSetIterator)- Specified by:
onEpochEndin interfaceTrainingListener- Overrides:
onEpochEndin classBaseTrainingListener
-
onForwardPass
public void onForwardPass(Model model, List<INDArray> activations)
Description copied from interface:TrainingListenerCalled once per iteration (forward pass) for activations (usually for aMultiLayerNetwork), only at training time- Specified by:
onForwardPassin interfaceTrainingListener- Overrides:
onForwardPassin classBaseTrainingListener- Parameters:
model- Modelactivations- Layer activations (including input)
-
onForwardPass
public void onForwardPass(Model model, Map<String,INDArray> activations)
Description copied from interface:TrainingListenerCalled once per iteration (forward pass) for activations (usually for aComputationGraph), only at training time- Specified by:
onForwardPassin interfaceTrainingListener- Overrides:
onForwardPassin classBaseTrainingListener- Parameters:
model- Modelactivations- Layer activations (including input)
-
iterationDone
public void iterationDone(Model model, int iteration, int epoch)
Description copied from interface:TrainingListenerEvent listener for each iteration. Called once, after each parameter update has ocurred while training the network- Specified by:
iterationDonein interfaceTrainingListener- Overrides:
iterationDonein classBaseTrainingListener- Parameters:
model- the model iteratingiteration- the iteration
-
onBackwardPass
public void onBackwardPass(Model model)
Description copied from interface:TrainingListenerCalled once per iteration (backward pass) after gradients have been calculated, and updated Gradients are available viaModel.gradient().Unlike
TrainingListener.onGradientCalculation(Model)the gradients at this point will be post-update, rather than raw (pre-update) gradients at that method call.- Specified by:
onBackwardPassin interfaceTrainingListener- Overrides:
onBackwardPassin classBaseTrainingListener- Parameters:
model- Model
-
onGradientCalculation
public void onGradientCalculation(Model model)
Description copied from interface:TrainingListenerCalled once per iteration (backward pass) before the gradients are updated Gradients are available viaModel.gradient(). Note that gradients will likely be updated in-place - thus they should be copied or processed synchronously in this method.For updates (gradients post learning rate/momentum/rmsprop etc) see
TrainingListener.onBackwardPass(Model)- Specified by:
onGradientCalculationin interfaceTrainingListener- Overrides:
onGradientCalculationin classBaseTrainingListener- Parameters:
model- Model
-
-