Package org.nd4j.autodiff.listeners.impl
Class UIListener
- java.lang.Object
-
- org.nd4j.autodiff.listeners.BaseListener
-
- org.nd4j.autodiff.listeners.impl.UIListener
-
- All Implemented Interfaces:
Listener
public class UIListener extends BaseListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUIListener.Builderstatic classUIListener.FileModeDefault: FileMode.CREATE_OR_APPEND
The mode for handling behaviour when an existing UI file already exists
CREATE: Only allow new file creation.static classUIListener.HistogramTypeUsed to specify which histograms should be collected.static classUIListener.TestEvaluationstatic classUIListener.UpdateRatioUsed to specify how the Update:Parameter ratios are computed.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UIListener.Builderbuilder(File logFile)protected voidcheckStructureForRestore(SameDiff sd)ListenerResponseepochEnd(SameDiff sd, At at, LossCurve lossCurve, long epochTimeMillis)Called at the end of every epoch, when fitting from an iteratorvoidepochStart(SameDiff sd, At at)Called at the start of every epoch, when fitting from an iteratorprotected voidinitalizeWriter(SameDiff sd)protected voidinitializeHelper(SameDiff sd)booleanisActive(Operation operation)Returns whether this listener is active during the given operation.voiditerationDone(SameDiff sd, At at, MultiDataSet dataSet, Loss loss)Called at the end of every iteration, after all operations (including updating parameters) has been completedvoiditerationStart(SameDiff sd, At at, MultiDataSet data, long etlMs)Called at the start of every iteration (minibatch), before any operations have been executedvoidopExecution(SameDiff sd, At at, MultiDataSet batch, SameDiffOp op, OpContext opContext, INDArray[] outputs)Called at the end of each operation executionvoidpreUpdate(SameDiff sd, At at, Variable v, INDArray update)Called just before each parameter is to be updated - i.e., just before each parameter is modified.protected voidrestoreLogFile()-
Methods inherited from class org.nd4j.autodiff.listeners.BaseListener
activationAvailable, operationEnd, operationStart, preOpExecution, requiredVariables, validationDone
-
-
-
-
Method Detail
-
restoreLogFile
protected void restoreLogFile()
-
checkStructureForRestore
protected void checkStructureForRestore(SameDiff sd)
-
initalizeWriter
protected void initalizeWriter(SameDiff sd)
-
initializeHelper
protected void initializeHelper(SameDiff sd) throws IOException
- Throws:
IOException
-
isActive
public boolean isActive(Operation operation)
Description copied from interface:ListenerReturns whether this listener is active during the given operation. If this returns false for the given operation, those listener methods will not be called.
-
epochStart
public void epochStart(SameDiff sd, At at)
Description copied from interface:ListenerCalled at the start of every epoch, when fitting from an iterator- Specified by:
epochStartin interfaceListener- Overrides:
epochStartin classBaseListener- Parameters:
sd- The SameDiff instanceat- Current iteration/epoch etc
-
epochEnd
public ListenerResponse epochEnd(SameDiff sd, At at, LossCurve lossCurve, long epochTimeMillis)
Description copied from interface:ListenerCalled at the end of every epoch, when fitting from an iterator- Specified by:
epochEndin interfaceListener- Overrides:
epochEndin classBaseListener- Parameters:
sd- The SameDiff instanceat- Current iteration/epoch etclossCurve- The losses so farepochTimeMillis- How long this epoch took- Returns:
- ListenerResponse.STOP to stop training, CONTINUE or null to continue
-
iterationStart
public void iterationStart(SameDiff sd, At at, MultiDataSet data, long etlMs)
Description copied from interface:ListenerCalled at the start of every iteration (minibatch), before any operations have been executed- Specified by:
iterationStartin interfaceListener- Overrides:
iterationStartin classBaseListener- Parameters:
sd- The SameDiff instanceat- Current iteration/epoch etc
-
iterationDone
public void iterationDone(SameDiff sd, At at, MultiDataSet dataSet, Loss loss)
Description copied from interface:ListenerCalled at the end of every iteration, after all operations (including updating parameters) has been completed- Specified by:
iterationDonein interfaceListener- Overrides:
iterationDonein classBaseListener- Parameters:
sd- The SameDiff instanceat- Current iteration/epoch etcdataSet- The current dataset (minibatch) used for trainingloss- The loss value for the current minibatch. Will be null except for during training
-
opExecution
public void opExecution(SameDiff sd, At at, MultiDataSet batch, SameDiffOp op, OpContext opContext, INDArray[] outputs)
Description copied from interface:ListenerCalled at the end of each operation execution
Note: Outputs will most likely be freed later, use detach() if you need to save it.
- Specified by:
opExecutionin interfaceListener- Overrides:
opExecutionin classBaseListener- Parameters:
sd- The SameDiff instanceat- Current iteration/epoch etcbatch- The batch's input data. May be null if not called with a batchop- Operation that has just been executedoutputs- The output arrays for the just-executed operation
-
preUpdate
public void preUpdate(SameDiff sd, At at, Variable v, INDArray update)
Description copied from interface:ListenerCalled just before each parameter is to be updated - i.e., just before each parameter is modified.- Specified by:
preUpdatein interfaceListener- Overrides:
preUpdatein classBaseListener- Parameters:
sd- SameDiff instanceat- The current iteration/epoch etcv- Variable about to be updated during backpropupdate- The array representing the update (i.e., the gradient after applying learning rate, momentum, etc)
-
builder
public static UIListener.Builder builder(File logFile)
-
-