Interface OpExecutioner
-
- All Known Subinterfaces:
GridExecutioner
- All Known Implementing Classes:
DefaultOpExecutioner
public interface OpExecutioner
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classOpExecutioner.ExecutionerTypestatic classOpExecutioner.ProfilingMode
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description INDArray[]allocateOutputArrays(CustomOp op)Equivalent to calliINDArraybitmapDecode(INDArray encoded, INDArray target)INDArraybitmapEncode(INDArray indArray, double threshold)longbitmapEncode(INDArray indArray, INDArray target, double threshold)This method returns number of elements affected by encoderOpContextbuildContext()This method returns OpContext which can be used (and reused) to execute custom opsList<LongShapeDescriptor>calculateOutputShape(CustomOp op)List<LongShapeDescriptor>calculateOutputShape(CustomOp op, OpContext opContext)voidcommit()This method ensures all operations that supposed to be executed at this moment, are executed and finished.DataBuffercreateConstantBuffer(double[] values, DataType desiredType)DataBuffercreateConstantBuffer(float[] values, DataType desiredType)DataBuffercreateConstantBuffer(int[] values, DataType desiredType)DataBuffercreateConstantBuffer(long[] values, DataType desiredType)This method returns constant buffer for the given jvm arrayDataBuffercreateShapeInfo(long[] shape, long[] stride, long elementWiseStride, char order, DataType dtype, boolean empty)This method returns shapeInfo DataBufferDataBuffercreateShapeInfo(long[] shape, long[] stride, long elementWiseStride, char order, DataType dtype, long extra)voidenableDebugMode(boolean reallyEnable)voidenableVerboseMode(boolean reallyEnable)voidexec(List<Aggregate> batch)This method takes arbitrary sized list of aggregates, and packs them into batchesvoidexec(Aggregate op)<T extends Aggregate>
voidexec(Batch<T> batch)This method executes previously built batchINDArrayexec(BroadcastOp broadcast)Execute a broadcast op, possibly along one or more dimensionsINDArray[]exec(CustomOp op)INDArray[]exec(CustomOp op, OpContext context)This method executes op with given contextvoidexec(GridOp op)Execute GridOpINDArrayexec(Variance accumulation)Execute an variance accumulation op, possibly along one or more dimensionsINDArrayexec(IndexAccumulation indexAccum)Execute an index accumulation along one or more dimensionsvoidexec(MetaOp op)Execute MetaOpINDArrayexec(Op op)Execute the operationINDArrayexec(Op op, OpContext opContext)Execute the operationINDArrayexec(RandomOp op)This method executes specified RandomOp using default RNG available via Nd4j.getRandom()INDArrayexec(RandomOp op, Random rng)This method executes specific RandomOp against specified RNGINDArrayexec(ReduceOp reduceOp)Execute a reduceOp, possibly along one or more dimensionsINDArrayexec(ScalarOp broadcast)Execute ScalarOpBroadcastOpexecAndReturn(BroadcastOp op)Execute and return the result from a vector opCustomOpexecAndReturn(CustomOp op)This method executes given CustomOp PLEASE NOTE: You're responsible for input/output validationVarianceexecAndReturn(Variance op)Execute and return the result from an accumulationIndexAccumulationexecAndReturn(IndexAccumulation op)Execute and return the result from an index accumulationOpexecAndReturn(Op op)Execute and return a result ndarray from the given opReduceOpexecAndReturn(ReduceOp op)Execute and return the result from an accumulationScalarOpexecAndReturn(ScalarOp op)Execute and return the result from a scalar opTransformOpexecAndReturn(TransformOp op)Execute a TransformOp and return the resultMap<String,INDArray>executeGraph(long id, Map<String,INDArray> map, Map<String,Integer> reverseMap)voidforgetGraph(long id)Map<String,CustomOpDescriptor>getCustomOperations()This method returns names of all custom operations available in current backend, and their number of input/output argumentsPropertiesgetEnvironmentInformation()This method return set of key/value and key/key/value objects, describing current environmentStringgetLastOp()This method returns opName of the last invoked opOpExecutioner.ProfilingModegetProfilingMode()Deprecated.StringgetString(DataBuffer buffer, long index)This method extracts String from Utf8BufferTADManagergetTADManager()This method returns TADManager instance used for this OpExecutionerINDArrayStatisticsinspectArray(INDArray array)booleanisDebug()This method returns true if debug mode is enabled, false otherwisebooleanisExperimentalMode()booleanisVerbose()This method returns true if verbose mode is enabled, false otherwisevoidprintEnvironmentInformation()This method prints out environmental information returned by getEnvironmentInformation() methodvoidpush()This method ensures all operations that supposed to be executed at this moment, are executed.voidregisterGraph(long id, org.bytedeco.javacpp.Pointer graph)voidscatterUpdate(ScatterUpdate.UpdateOp op, @NonNull INDArray array, @NonNull INDArray indices, @NonNull INDArray updates, int[] axis)Deprecated.voidsetElementsThreshold(int threshold)This method allows to set desired number of elements per thread, for performance optimization purposes.voidsetProfilingConfig(ProfilerConfig config)This method stores specified configuration.voidsetProfilingMode(OpExecutioner.ProfilingMode mode)Deprecated.voidsetTadThreshold(int threshold)This method allows to set desired number of sub-arrays per thread, for performance optimization purposes.TadPacktadShapeInfoAndOffsets(INDArray array, int[] dimension)This method returns host/device tad buffersINDArraythresholdDecode(INDArray encoded, INDArray target)This method decodes thresholds array, and puts it into target arrayINDArraythresholdEncode(INDArray input, double threshold)This method encodes array as thresholds, updating input array at the same timeINDArraythresholdEncode(INDArray input, double threshold, Integer boundary)This method encodes array as thresholds, updating input array at the same timeOpExecutioner.ExecutionerTypetype()This method returns type for this executioner instanceintuseCount(DataBuffer buffer)This method returns reference use count from the Buffer
-
-
-
Method Detail
-
isVerbose
boolean isVerbose()
This method returns true if verbose mode is enabled, false otherwise- Returns:
-
isDebug
boolean isDebug()
This method returns true if debug mode is enabled, false otherwise- Returns:
-
type
OpExecutioner.ExecutionerType type()
This method returns type for this executioner instance- Returns:
-
getLastOp
String getLastOp()
This method returns opName of the last invoked op- Returns:
-
exec
INDArray exec(Op op, OpContext opContext)
Execute the operation- Parameters:
op- the operation to execute
-
execAndReturn
TransformOp execAndReturn(TransformOp op)
Execute a TransformOp and return the result- Parameters:
op- the operation to execute
-
execAndReturn
ReduceOp execAndReturn(ReduceOp op)
Execute and return the result from an accumulation- Parameters:
op- the operation to execute- Returns:
- the accumulated result
-
execAndReturn
Variance execAndReturn(Variance op)
Execute and return the result from an accumulation- Parameters:
op- the operation to execute- Returns:
- the accumulated result
-
execAndReturn
IndexAccumulation execAndReturn(IndexAccumulation op)
Execute and return the result from an index accumulation- Parameters:
op- the index accumulation operation to execute- Returns:
- the accumulated index
-
execAndReturn
ScalarOp execAndReturn(ScalarOp op)
Execute and return the result from a scalar op- Parameters:
op- the operation to execute- Returns:
- the accumulated result
-
execAndReturn
BroadcastOp execAndReturn(BroadcastOp op)
Execute and return the result from a vector op- Parameters:
op-
-
exec
INDArray exec(ReduceOp reduceOp)
Execute a reduceOp, possibly along one or more dimensions- Parameters:
reduceOp- the reduceOp- Returns:
- the reduceOp op
-
exec
INDArray exec(BroadcastOp broadcast)
Execute a broadcast op, possibly along one or more dimensions- Parameters:
broadcast- the accumulation- Returns:
- the broadcast op
-
exec
INDArray exec(Variance accumulation)
Execute an variance accumulation op, possibly along one or more dimensions- Parameters:
accumulation- the accumulation- Returns:
- the accmulation op
-
exec
INDArray exec(IndexAccumulation indexAccum)
Execute an index accumulation along one or more dimensions- Parameters:
indexAccum- the index accumulation operation- Returns:
- result
-
execAndReturn
Op execAndReturn(Op op)
Execute and return a result ndarray from the given op- Parameters:
op- the operation to execute- Returns:
- the result from the operation
-
exec
void exec(MetaOp op)
Execute MetaOp- Parameters:
op-
-
exec
void exec(GridOp op)
Execute GridOp- Parameters:
op-
-
exec
void exec(Aggregate op)
- Parameters:
op-
-
exec
<T extends Aggregate> void exec(Batch<T> batch)
This method executes previously built batch- Parameters:
batch-
-
exec
void exec(List<Aggregate> batch)
This method takes arbitrary sized list of aggregates, and packs them into batches- Parameters:
batch-
-
exec
INDArray exec(RandomOp op)
This method executes specified RandomOp using default RNG available via Nd4j.getRandom()- Parameters:
op-
-
exec
INDArray exec(RandomOp op, Random rng)
This method executes specific RandomOp against specified RNG- Parameters:
op-rng-
-
getEnvironmentInformation
Properties getEnvironmentInformation()
This method return set of key/value and key/key/value objects, describing current environment- Returns:
-
setProfilingMode
@Deprecated void setProfilingMode(OpExecutioner.ProfilingMode mode)
Deprecated.This method specifies desired profiling mode- Parameters:
mode-
-
setProfilingConfig
void setProfilingConfig(ProfilerConfig config)
This method stores specified configuration.- Parameters:
config-
-
getProfilingMode
@Deprecated OpExecutioner.ProfilingMode getProfilingMode()
Deprecated.Ths method returns current profiling- Returns:
-
getTADManager
TADManager getTADManager()
This method returns TADManager instance used for this OpExecutioner- Returns:
-
printEnvironmentInformation
void printEnvironmentInformation()
This method prints out environmental information returned by getEnvironmentInformation() method
-
push
void push()
This method ensures all operations that supposed to be executed at this moment, are executed.
-
commit
void commit()
This method ensures all operations that supposed to be executed at this moment, are executed and finished.
-
thresholdEncode
INDArray thresholdEncode(INDArray input, double threshold)
This method encodes array as thresholds, updating input array at the same time- Parameters:
input-- Returns:
- encoded array is returned
-
thresholdEncode
INDArray thresholdEncode(INDArray input, double threshold, Integer boundary)
This method encodes array as thresholds, updating input array at the same time- Parameters:
input-- Returns:
- encoded array is returned
-
thresholdDecode
INDArray thresholdDecode(INDArray encoded, INDArray target)
This method decodes thresholds array, and puts it into target array- Parameters:
encoded-target-- Returns:
- target is returned
-
bitmapEncode
long bitmapEncode(INDArray indArray, INDArray target, double threshold)
This method returns number of elements affected by encoder- Parameters:
indArray-target-threshold-- Returns:
-
bitmapEncode
INDArray bitmapEncode(INDArray indArray, double threshold)
- Parameters:
indArray-threshold-- Returns:
-
bitmapDecode
INDArray bitmapDecode(INDArray encoded, INDArray target)
- Parameters:
encoded-target-- Returns:
-
getCustomOperations
Map<String,CustomOpDescriptor> getCustomOperations()
This method returns names of all custom operations available in current backend, and their number of input/output arguments- Returns:
-
execAndReturn
CustomOp execAndReturn(CustomOp op)
This method executes given CustomOp PLEASE NOTE: You're responsible for input/output validation- Parameters:
op-
-
exec
INDArray[] exec(CustomOp op, OpContext context)
This method executes op with given context- Parameters:
op-context-- Returns:
- method returns output arrays defined within context
-
calculateOutputShape
List<LongShapeDescriptor> calculateOutputShape(CustomOp op)
-
calculateOutputShape
List<LongShapeDescriptor> calculateOutputShape(CustomOp op, OpContext opContext)
-
enableDebugMode
void enableDebugMode(boolean reallyEnable)
-
enableVerboseMode
void enableVerboseMode(boolean reallyEnable)
-
isExperimentalMode
boolean isExperimentalMode()
-
registerGraph
void registerGraph(long id, org.bytedeco.javacpp.Pointer graph)
-
executeGraph
Map<String,INDArray> executeGraph(long id, Map<String,INDArray> map, Map<String,Integer> reverseMap)
-
forgetGraph
void forgetGraph(long id)
-
setElementsThreshold
void setElementsThreshold(int threshold)
This method allows to set desired number of elements per thread, for performance optimization purposes. I.e. if array contains 2048 elements, and threshold is set to 1024, 2 threads will be used for given op execution. Default value: 1024- Parameters:
threshold-
-
setTadThreshold
void setTadThreshold(int threshold)
This method allows to set desired number of sub-arrays per thread, for performance optimization purposes. I.e. if matrix has shape of 64 x 128, and threshold is set to 8, each thread will be processing 8 sub-arrays (sure, if you have 8 core cpu). If your cpu has, say, 4, cores, only 4 threads will be spawned, and each will process 16 sub-arrays Default value: 8- Parameters:
threshold-
-
getString
String getString(DataBuffer buffer, long index)
This method extracts String from Utf8Buffer- Parameters:
buffer-index-- Returns:
-
scatterUpdate
@Deprecated void scatterUpdate(ScatterUpdate.UpdateOp op, @NonNull @NonNull INDArray array, @NonNull @NonNull INDArray indices, @NonNull @NonNull INDArray updates, int[] axis)
Deprecated.Temporary hook- Parameters:
op-array-indices-updates-axis-
-
buildContext
OpContext buildContext()
This method returns OpContext which can be used (and reused) to execute custom ops- Returns:
-
inspectArray
INDArrayStatistics inspectArray(INDArray array)
- Parameters:
array-
-
createShapeInfo
DataBuffer createShapeInfo(long[] shape, long[] stride, long elementWiseStride, char order, DataType dtype, boolean empty)
This method returns shapeInfo DataBuffer- Parameters:
shape-stride-elementWiseStride-order-dtype-- Returns:
-
createShapeInfo
DataBuffer createShapeInfo(long[] shape, long[] stride, long elementWiseStride, char order, DataType dtype, long extra)
-
tadShapeInfoAndOffsets
TadPack tadShapeInfoAndOffsets(INDArray array, int[] dimension)
This method returns host/device tad buffers
-
createConstantBuffer
DataBuffer createConstantBuffer(long[] values, DataType desiredType)
This method returns constant buffer for the given jvm array- Parameters:
values-- Returns:
-
createConstantBuffer
DataBuffer createConstantBuffer(int[] values, DataType desiredType)
-
createConstantBuffer
DataBuffer createConstantBuffer(float[] values, DataType desiredType)
-
createConstantBuffer
DataBuffer createConstantBuffer(double[] values, DataType desiredType)
-
useCount
int useCount(DataBuffer buffer)
This method returns reference use count from the Buffer- Parameters:
buffer-- Returns:
-
-