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 class
OpExecutioner.ExecutionerType
static class
OpExecutioner.ProfilingMode
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description INDArray[]
allocateOutputArrays(CustomOp op)
Equivalent to calliINDArray
bitmapDecode(INDArray encoded, INDArray target)
INDArray
bitmapEncode(INDArray indArray, double threshold)
long
bitmapEncode(INDArray indArray, INDArray target, double threshold)
This method returns number of elements affected by encoderOpContext
buildContext()
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)
void
commit()
This method ensures all operations that supposed to be executed at this moment, are executed and finished.DataBuffer
createConstantBuffer(double[] values, DataType desiredType)
DataBuffer
createConstantBuffer(float[] values, DataType desiredType)
DataBuffer
createConstantBuffer(int[] values, DataType desiredType)
DataBuffer
createConstantBuffer(long[] values, DataType desiredType)
This method returns constant buffer for the given jvm arrayDataBuffer
createShapeInfo(long[] shape, long[] stride, long elementWiseStride, char order, DataType dtype, boolean empty)
This method returns shapeInfo DataBufferDataBuffer
createShapeInfo(long[] shape, long[] stride, long elementWiseStride, char order, DataType dtype, long extra)
void
enableDebugMode(boolean reallyEnable)
void
enableVerboseMode(boolean reallyEnable)
void
exec(List<Aggregate> batch)
This method takes arbitrary sized list of aggregates, and packs them into batchesvoid
exec(Aggregate op)
<T extends Aggregate>
voidexec(Batch<T> batch)
This method executes previously built batchINDArray
exec(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 contextvoid
exec(GridOp op)
Execute GridOpINDArray
exec(Variance accumulation)
Execute an variance accumulation op, possibly along one or more dimensionsINDArray
exec(IndexAccumulation indexAccum)
Execute an index accumulation along one or more dimensionsvoid
exec(MetaOp op)
Execute MetaOpINDArray
exec(Op op)
Execute the operationINDArray
exec(Op op, OpContext opContext)
Execute the operationINDArray
exec(RandomOp op)
This method executes specified RandomOp using default RNG available via Nd4j.getRandom()INDArray
exec(RandomOp op, Random rng)
This method executes specific RandomOp against specified RNGINDArray
exec(ReduceOp reduceOp)
Execute a reduceOp, possibly along one or more dimensionsINDArray
exec(ScalarOp broadcast)
Execute ScalarOpBroadcastOp
execAndReturn(BroadcastOp op)
Execute and return the result from a vector opCustomOp
execAndReturn(CustomOp op)
This method executes given CustomOp PLEASE NOTE: You're responsible for input/output validationVariance
execAndReturn(Variance op)
Execute and return the result from an accumulationIndexAccumulation
execAndReturn(IndexAccumulation op)
Execute and return the result from an index accumulationOp
execAndReturn(Op op)
Execute and return a result ndarray from the given opReduceOp
execAndReturn(ReduceOp op)
Execute and return the result from an accumulationScalarOp
execAndReturn(ScalarOp op)
Execute and return the result from a scalar opTransformOp
execAndReturn(TransformOp op)
Execute a TransformOp and return the resultMap<String,INDArray>
executeGraph(long id, Map<String,INDArray> map, Map<String,Integer> reverseMap)
void
forgetGraph(long id)
Map<String,CustomOpDescriptor>
getCustomOperations()
This method returns names of all custom operations available in current backend, and their number of input/output argumentsProperties
getEnvironmentInformation()
This method return set of key/value and key/key/value objects, describing current environmentString
getLastOp()
This method returns opName of the last invoked opOpExecutioner.ProfilingMode
getProfilingMode()
Deprecated.String
getString(DataBuffer buffer, long index)
This method extracts String from Utf8BufferTADManager
getTADManager()
This method returns TADManager instance used for this OpExecutionerINDArrayStatistics
inspectArray(INDArray array)
boolean
isDebug()
This method returns true if debug mode is enabled, false otherwiseboolean
isExperimentalMode()
boolean
isVerbose()
This method returns true if verbose mode is enabled, false otherwisevoid
printEnvironmentInformation()
This method prints out environmental information returned by getEnvironmentInformation() methodvoid
push()
This method ensures all operations that supposed to be executed at this moment, are executed.void
registerGraph(long id, org.bytedeco.javacpp.Pointer graph)
void
scatterUpdate(ScatterUpdate.UpdateOp op, @NonNull INDArray array, @NonNull INDArray indices, @NonNull INDArray updates, int[] axis)
Deprecated.void
setElementsThreshold(int threshold)
This method allows to set desired number of elements per thread, for performance optimization purposes.void
setProfilingConfig(ProfilerConfig config)
This method stores specified configuration.void
setProfilingMode(OpExecutioner.ProfilingMode mode)
Deprecated.void
setTadThreshold(int threshold)
This method allows to set desired number of sub-arrays per thread, for performance optimization purposes.TadPack
tadShapeInfoAndOffsets(INDArray array, int[] dimension)
This method returns host/device tad buffersINDArray
thresholdDecode(INDArray encoded, INDArray target)
This method decodes thresholds array, and puts it into target arrayINDArray
thresholdEncode(INDArray input, double threshold)
This method encodes array as thresholds, updating input array at the same timeINDArray
thresholdEncode(INDArray input, double threshold, Integer boundary)
This method encodes array as thresholds, updating input array at the same timeOpExecutioner.ExecutionerType
type()
This method returns type for this executioner instanceint
useCount(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:
-
-