Class ProfilingListener
- java.lang.Object
-
- org.nd4j.autodiff.listeners.BaseListener
-
- org.nd4j.autodiff.listeners.profiler.ProfilingListener
-
- All Implemented Interfaces:
Listener
public class ProfilingListener extends BaseListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProfilingListener.Builder
-
Constructor Summary
Constructors Modifier Constructor Description protectedProfilingListener(@NonNull File outputFile, boolean all, int warmup, int nIter, long nMs, Operation[] operations)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ProfilingListener.Builderbuilder(File outputFile)Create a new builderbooleanisActive(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 completedstatic org.nd4j.shade.jackson.databind.ObjectMapperjsonMapper()Get a new JSON mapper for use in serializing/deserializing JSON formatvoidoperationEnd(SameDiff sd, Operation op)Called at the end of an operation, e.g.voidoperationStart(SameDiff sd, Operation op)Called at the start of an operation, e.g.voidopExecution(SameDiff sd, At at, MultiDataSet batch, SameDiffOp op, OpContext opContext, INDArray[] outputs)Called at the end of each operation executionvoidpreOpExecution(SameDiff sd, At at, SameDiffOp op, OpContext opContext)Called just before each operation is executed (native code called, etc) - after all inputs etc have been set-
Methods inherited from class org.nd4j.autodiff.listeners.BaseListener
activationAvailable, epochEnd, epochStart, iterationStart, preUpdate, requiredVariables, validationDone
-
-
-
-
Method Detail
-
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.
-
operationStart
public void operationStart(SameDiff sd, Operation op)
Description copied from interface:ListenerCalled at the start of an operation, e.g. training or validation- Specified by:
operationStartin interfaceListener- Overrides:
operationStartin classBaseListener- Parameters:
sd- The SameDiff instanceop- The operation being started
-
operationEnd
public void operationEnd(SameDiff sd, Operation op)
Description copied from interface:ListenerCalled at the end of an operation, e.g. training or validation- Specified by:
operationEndin interfaceListener- Overrides:
operationEndin classBaseListener- Parameters:
sd- The SameDiff instanceop- The operation being started
-
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
-
preOpExecution
public void preOpExecution(SameDiff sd, At at, SameDiffOp op, OpContext opContext)
Description copied from interface:ListenerCalled just before each operation is executed (native code called, etc) - after all inputs etc have been set- Specified by:
preOpExecutionin interfaceListener- Overrides:
preOpExecutionin classBaseListener- Parameters:
sd- The SameDiff instanceat- Current iteration/epoch etcop- Operation that has just been executed
-
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
-
jsonMapper
public static org.nd4j.shade.jackson.databind.ObjectMapper jsonMapper()
Get a new JSON mapper for use in serializing/deserializing JSON format
-
builder
public static ProfilingListener.Builder builder(File outputFile)
Create a new builder- Parameters:
outputFile- Output file. Will be overwritten if file already exists
-
-