Class BaseEvaluationListener
- java.lang.Object
-
- org.nd4j.autodiff.listeners.BaseListener
-
- org.nd4j.autodiff.listeners.BaseEvaluationListener
-
- All Implemented Interfaces:
Listener
- Direct Known Subclasses:
HistoryListener
public abstract class BaseEvaluationListener extends BaseListener
-
-
Constructor Summary
Constructors Constructor Description BaseEvaluationListener()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidactivationAvailable(SameDiff sd, At at, MultiDataSet batch, SameDiffOp op, String varName, INDArray activation)Called when any activation becomes available.voidactivationAvailableEvaluations(SameDiff sd, At at, MultiDataSet batch, SameDiffOp op, String varName, INDArray activation)ListenerResponseepochEnd(SameDiff sd, At at, LossCurve lossCurve, long epochTimeMillis)Called at the end of every epoch, when fitting from an iteratorListenerResponseepochEndEvaluations(SameDiff sd, At at, LossCurve lossCurve, long epochTimeMillis, EvaluationRecord evaluations)SeeListener.epochEnd(SameDiff, At, LossCurve, long), also provided the requested evaluationsvoidepochStart(SameDiff sd, At at)Called at the start of every epoch, when fitting from an iteratorvoidepochStartEvaluations(SameDiff sd, At at)abstract ListenerEvaluationsevaluations()Return the requested evaluations.ListenerVariablesotherRequiredVariables(SameDiff sd)Return any requested variables that are not part of the evaluationsListenerVariablesrequiredVariables(SameDiff sd)Required variables for this listener.ListenerResponsevalidationDone(SameDiff sd, At at, long validationTimeMillis)Called after the end of every epoch, once validation evaluation is done, when trainingListenerResponsevalidationDoneEvaluations(SameDiff sd, At at, long validationTimeMillis, EvaluationRecord evaluations)SeeListener.validationDone(SameDiff, At, long), also provided the requested evaluations-
Methods inherited from class org.nd4j.autodiff.listeners.BaseListener
iterationDone, iterationStart, operationEnd, operationStart, opExecution, preOpExecution, preUpdate
-
-
-
-
Method Detail
-
evaluations
public abstract ListenerEvaluations evaluations()
Return the requested evaluations. New instances of these evaluations will be made each time they are used
-
requiredVariables
public final ListenerVariables requiredVariables(SameDiff sd)
Description copied from interface:ListenerRequired variables for this listener.Used to ensure these variables end up in the minimum required subgraph calculated by
InferenceSession. Otherwise, if the variables weren't required by a loss variable, they would not be calculated.Any variables in here are guaranteed to have
Listener.activationAvailable(SameDiff, At, MultiDataSet, SameDiffOp, String, INDArray)called for them, regardless of whether they would normally be calculated or not.- Specified by:
requiredVariablesin interfaceListener- Overrides:
requiredVariablesin classBaseListener
-
otherRequiredVariables
public ListenerVariables otherRequiredVariables(SameDiff sd)
Return any requested variables that are not part of the evaluations
-
epochStart
public final 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 final 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
-
epochEndEvaluations
public ListenerResponse epochEndEvaluations(SameDiff sd, At at, LossCurve lossCurve, long epochTimeMillis, EvaluationRecord evaluations)
SeeListener.epochEnd(SameDiff, At, LossCurve, long), also provided the requested evaluations
-
validationDone
public final ListenerResponse validationDone(SameDiff sd, At at, long validationTimeMillis)
Description copied from interface:ListenerCalled after the end of every epoch, once validation evaluation is done, when training- Specified by:
validationDonein interfaceListener- Overrides:
validationDonein classBaseListener- Parameters:
sd- The SameDiff instanceat- Current iteration/epoch etcvalidationTimeMillis- How long validation took for this epoch- Returns:
- ListenerResponse.STOP to stop training, CONTINUE or null to continue
-
validationDoneEvaluations
public ListenerResponse validationDoneEvaluations(SameDiff sd, At at, long validationTimeMillis, EvaluationRecord evaluations)
SeeListener.validationDone(SameDiff, At, long), also provided the requested evaluations
-
activationAvailable
public final void activationAvailable(SameDiff sd, At at, MultiDataSet batch, SameDiffOp op, String varName, INDArray activation)
Description copied from interface:ListenerCalled when any activation becomes available.The activation will most likely be freed later, use dup() if you need to save it.
Note that this method will be called when any activation becomes available, not just ones fromListener.requiredVariables(SameDiff)
It is guaranteed to be called for variables from requiredVariables().
Note that the activations here overlap withListener.opExecution(SameDiff, At, MultiDataSet, SameDiffOp, OpContext, INDArray[])- both contain the same information/arrays- Specified by:
activationAvailablein interfaceListener- Overrides:
activationAvailablein 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 executedvarName- The name of the variableactivation- The variable's activation
-
activationAvailableEvaluations
public void activationAvailableEvaluations(SameDiff sd, At at, MultiDataSet batch, SameDiffOp op, String varName, INDArray activation)
-
-