public class SleepyTrainingListener extends BaseTrainingListener implements Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
SleepyTrainingListener.SleepMode |
static class |
SleepyTrainingListener.TimeMode |
| Modifier and Type | Field and Description |
|---|---|
protected ThreadLocal<AtomicLong> |
lastBP |
protected ThreadLocal<AtomicLong> |
lastEE |
protected ThreadLocal<AtomicLong> |
lastES |
protected ThreadLocal<AtomicLong> |
lastFF |
protected ThreadLocal<AtomicLong> |
lastIteration |
protected SleepyTrainingListener.SleepMode |
sleepMode |
protected SleepyTrainingListener.TimeMode |
timeMode |
protected long |
timerBP |
protected long |
timerEE |
protected long |
timerES |
protected long |
timerFF |
protected long |
timerIteration |
| Constructor and Description |
|---|
SleepyTrainingListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
iterationDone(Model model,
int iteration,
int epoch)
Event listener for each iteration.
|
void |
onBackwardPass(Model model)
Called once per iteration (backward pass) after gradients have been calculated, and updated
Gradients are available via
Model.gradient(). |
void |
onEpochEnd(Model model)
Called once at the end of each epoch, when using methods such as
MultiLayerNetwork.fit(DataSetIterator),
ComputationGraph.fit(DataSetIterator) or ComputationGraph.fit(MultiDataSetIterator) |
void |
onEpochStart(Model model)
Called once at the start of each epoch, when using methods such as
MultiLayerNetwork.fit(DataSetIterator),
ComputationGraph.fit(DataSetIterator) or ComputationGraph.fit(MultiDataSetIterator) |
void |
onForwardPass(Model model,
List<org.nd4j.linalg.api.ndarray.INDArray> activations)
Called once per iteration (forward pass) for activations (usually for a
MultiLayerNetwork),
only at training time |
void |
onForwardPass(Model model,
Map<String,org.nd4j.linalg.api.ndarray.INDArray> activations)
Called once per iteration (forward pass) for activations (usually for a
ComputationGraph),
only at training time |
void |
onGradientCalculation(Model model)
Called once per iteration (backward pass) before the gradients are updated
Gradients are available via
Model.gradient(). |
protected void |
sleep(AtomicLong lastTime,
long sleepTime) |
protected void |
sleep(long sleepTimeMs) |
protected final transient ThreadLocal<AtomicLong> lastEE
protected final transient ThreadLocal<AtomicLong> lastES
protected final transient ThreadLocal<AtomicLong> lastFF
protected final transient ThreadLocal<AtomicLong> lastBP
protected final transient ThreadLocal<AtomicLong> lastIteration
protected long timerEE
protected long timerES
protected long timerFF
protected long timerBP
protected long timerIteration
protected SleepyTrainingListener.SleepMode sleepMode
protected SleepyTrainingListener.TimeMode timeMode
protected void sleep(long sleepTimeMs)
protected void sleep(AtomicLong lastTime, long sleepTime)
public void onEpochStart(Model model)
TrainingListenerMultiLayerNetwork.fit(DataSetIterator),
ComputationGraph.fit(DataSetIterator) or ComputationGraph.fit(MultiDataSetIterator)onEpochStart in interface TrainingListeneronEpochStart in class BaseTrainingListenerpublic void onEpochEnd(Model model)
TrainingListenerMultiLayerNetwork.fit(DataSetIterator),
ComputationGraph.fit(DataSetIterator) or ComputationGraph.fit(MultiDataSetIterator)onEpochEnd in interface TrainingListeneronEpochEnd in class BaseTrainingListenerpublic void onForwardPass(Model model, List<org.nd4j.linalg.api.ndarray.INDArray> activations)
TrainingListenerMultiLayerNetwork),
only at training timeonForwardPass in interface TrainingListeneronForwardPass in class BaseTrainingListenermodel - Modelactivations - Layer activations (including input)public void onForwardPass(Model model, Map<String,org.nd4j.linalg.api.ndarray.INDArray> activations)
TrainingListenerComputationGraph),
only at training timeonForwardPass in interface TrainingListeneronForwardPass in class BaseTrainingListenermodel - Modelactivations - Layer activations (including input)public void iterationDone(Model model, int iteration, int epoch)
TrainingListeneriterationDone in interface TrainingListeneriterationDone in class BaseTrainingListenermodel - the model iteratingiteration - the iterationpublic void onBackwardPass(Model model)
TrainingListenerModel.gradient().
Unlike TrainingListener.onGradientCalculation(Model) the gradients at this point will be post-update, rather than
raw (pre-update) gradients at that method call.
onBackwardPass in interface TrainingListeneronBackwardPass in class BaseTrainingListenermodel - Modelpublic void onGradientCalculation(Model model)
TrainingListenerModel.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)
onGradientCalculation in interface TrainingListeneronGradientCalculation in class BaseTrainingListenermodel - ModelCopyright © 2018. All rights reserved.