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 void
activationAvailable(SameDiff sd, At at, MultiDataSet batch, SameDiffOp op, String varName, INDArray activation)
Called when any activation becomes available.void
activationAvailableEvaluations(SameDiff sd, At at, MultiDataSet batch, SameDiffOp op, String varName, INDArray activation)
ListenerResponse
epochEnd(SameDiff sd, At at, LossCurve lossCurve, long epochTimeMillis)
Called at the end of every epoch, when fitting from an iteratorListenerResponse
epochEndEvaluations(SameDiff sd, At at, LossCurve lossCurve, long epochTimeMillis, EvaluationRecord evaluations)
SeeListener.epochEnd(SameDiff, At, LossCurve, long)
, also provided the requested evaluationsvoid
epochStart(SameDiff sd, At at)
Called at the start of every epoch, when fitting from an iteratorvoid
epochStartEvaluations(SameDiff sd, At at)
abstract ListenerEvaluations
evaluations()
Return the requested evaluations.ListenerVariables
otherRequiredVariables(SameDiff sd)
Return any requested variables that are not part of the evaluationsListenerVariables
requiredVariables(SameDiff sd)
Required variables for this listener.ListenerResponse
validationDone(SameDiff sd, At at, long validationTimeMillis)
Called after the end of every epoch, once validation evaluation is done, when trainingListenerResponse
validationDoneEvaluations(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:Listener
Required 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:
requiredVariables
in interfaceListener
- Overrides:
requiredVariables
in 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:Listener
Called at the start of every epoch, when fitting from an iterator- Specified by:
epochStart
in interfaceListener
- Overrides:
epochStart
in 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:Listener
Called at the end of every epoch, when fitting from an iterator- Specified by:
epochEnd
in interfaceListener
- Overrides:
epochEnd
in 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:Listener
Called after the end of every epoch, once validation evaluation is done, when training- Specified by:
validationDone
in interfaceListener
- Overrides:
validationDone
in 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:Listener
Called 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:
activationAvailable
in interfaceListener
- Overrides:
activationAvailable
in 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)
-
-