public abstract class DefaultOpExecutioner extends Object implements OpExecutioner
OpExecutioner.ExecutionerType, OpExecutioner.ProfilingMode| Modifier and Type | Field and Description |
|---|---|
protected AtomicBoolean |
debug |
protected OpExecutioner.ProfilingMode |
profilingMode |
protected AtomicBoolean |
verbose |
| Constructor and Description |
|---|
DefaultOpExecutioner() |
| Modifier and Type | Method and Description |
|---|---|
INDArray[] |
allocateOutputArrays(CustomOp op)
Equivalent to calli
|
static List<String> |
allOpenWorkspaces() |
String |
arrayInfo(INDArray arr) |
INDArray |
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 encoder
|
OpContext |
buildContext()
This method returns OpContext which can be used (and reused) to execute custom ops
|
List<LongShapeDescriptor> |
calculateOutputShape(CustomOp op) |
List<LongShapeDescriptor> |
calculateOutputShape(CustomOp op,
OpContext opContext) |
protected void |
checkForCompression(Op op) |
protected void |
checkForWorkspaces(CustomOp op,
OpContext oc) |
protected void |
checkForWorkspaces(Op op,
OpContext oc) |
protected void |
checkWorkspace(String opName,
INDArray array) |
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 array
|
DataBuffer |
createShapeInfo(long[] shape,
long[] stride,
long elementWiseStride,
char order,
DataType dtype,
boolean empty)
This method returns shapeInfo DataBuffer
|
DataBuffer |
createShapeInfo(long[] shape,
long[] stride,
long elementWiseStride,
char order,
DataType dtype,
long extras) |
void |
enableDebugMode(boolean reallyEnable) |
void |
enableVerboseMode(boolean reallyEnable) |
void |
exec(Aggregate op) |
<T extends Aggregate> |
exec(Batch<T> batch)
This method executes previously built batch
|
abstract INDArray |
exec(BroadcastOp broadcast)
Execute a broadcast op, possibly along one or more dimensions
|
INDArray[] |
exec(CustomOp op) |
INDArray[] |
exec(CustomOp op,
OpContext context)
This method executes op with given context
|
void |
exec(GridOp op)
Execute GridOp
|
abstract INDArray |
exec(IndexAccumulation op)
Execute an index accumulation along one or more dimensions
|
void |
exec(List<Aggregate> batch)
This method takes arbitrary sized list of aggregates,
and packs them into batches
|
void |
exec(MetaOp op)
Execute MetaOp
|
abstract INDArray |
exec(Op op)
Execute the operation
|
abstract INDArray |
exec(Op op,
OpContext opContext)
Execute the operation
|
INDArray |
exec(RandomOp op)
This method executes specified RandomOp using default RNG available via Nd4j.getRandom()
|
abstract INDArray |
exec(RandomOp op,
Random rng)
This method executes specific RandomOp against specified RNG
|
abstract INDArray |
exec(ReduceOp op)
Execute a reduceOp, possibly along one or more dimensions
|
abstract INDArray |
exec(ScalarOp op)
Execute ScalarOp
|
abstract INDArray |
exec(Variance accumulation)
Execute an variance accumulation op, possibly along one or more dimensions
|
BroadcastOp |
execAndReturn(BroadcastOp op)
Execute and return the result from a vector op
|
CustomOp |
execAndReturn(CustomOp op)
This method executes given CustomOp
PLEASE NOTE: You're responsible for input/output validation
|
IndexAccumulation |
execAndReturn(IndexAccumulation op)
Execute and return the result from an index accumulation
|
Op |
execAndReturn(Op op)
Execute and return a result
ndarray from the given op
|
ReduceOp |
execAndReturn(ReduceOp op)
Execute and return the result from an accumulation
|
ScalarOp |
execAndReturn(ScalarOp op)
Execute and return the result from a scalar op
|
TransformOp |
execAndReturn(TransformOp op)
Execute a TransformOp and return the result
|
Variance |
execAndReturn(Variance op)
Execute and return the result from an accumulation
|
Map<String,INDArray> |
executeGraph(long id,
Map<String,INDArray> map,
Map<String,Integer> reverseMap) |
protected static String |
firstX(INDArray array,
int x) |
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 arguments
|
Properties |
getEnvironmentInformation()
This method return set of key/value and key/key/value objects, describing current environment
|
String |
getLastOp()
This method returns opName of the last invoked op
|
OpExecutioner.ProfilingMode |
getProfilingMode()
Deprecated.
|
String |
getString(DataBuffer buffer,
long index)
This method extracts String from Utf8Buffer
|
TADManager |
getTADManager()
This method returns TADManager instance used for this OpExecutioner
|
INDArray |
getX(Op op,
OpContext oc) |
INDArray |
getY(Op op,
OpContext oc) |
INDArray |
getZ(Op op,
OpContext oc) |
INDArrayStatistics |
inspectArray(INDArray array) |
protected void |
interceptIntDataType(Op op)
This method checks if any Op operand has data opType of INT, and throws exception if any.
|
boolean |
isDebug()
This method returns true if debug mode is enabled, false otherwise
|
boolean |
isExperimentalMode() |
boolean |
isVerbose()
This method returns true if verbose mode is enabled, false otherwise
|
String |
opInfoString(Op op,
Optional<int[]> dimensions)
Get the information about the op in a String representation, for throwing more useful exceptions (mainly for debugging)
|
void |
printEnvironmentInformation()
This method prints out environmental information returned by getEnvironmentInformation() method
|
long |
profilingConfigurableHookIn(CustomOp op,
OpContext oc) |
long |
profilingConfigurableHookIn(Op op,
DataBuffer... tadBuffers) |
void |
profilingConfigurableHookOut(CustomOp op,
OpContext oc,
long timeStart) |
void |
profilingConfigurableHookOut(Op op,
OpContext oc,
long timeStart) |
long |
profilingHookIn(CustomOp op,
OpContext oc)
Deprecated.
|
long |
profilingHookIn(Op op,
DataBuffer... tadBuffers)
Deprecated.
|
void |
profilingHookOut(CustomOp op,
OpContext oc,
long timeStart)
Deprecated.
|
void |
profilingHookOut(Op op,
OpContext oc,
long timeStart)
Deprecated.
|
void |
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,
INDArray array,
INDArray indices,
INDArray updates,
int[] axis)
Temporary hook
|
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.
|
void |
setX(INDArray x,
Op op,
OpContext oc) |
void |
setY(INDArray y,
Op op,
OpContext oc) |
void |
setZ(INDArray z,
Op op,
OpContext oc) |
TadPack |
tadShapeInfoAndOffsets(INDArray array,
int[] dimension)
This method returns host/device tad buffers
|
INDArray |
thresholdDecode(INDArray encoded,
INDArray target)
This method decodes thresholds array, and puts it into target array
|
INDArray |
thresholdEncode(INDArray input,
double threshold)
This method encodes array as thresholds, updating input array at the same time
|
INDArray |
thresholdEncode(INDArray input,
double threshold,
Integer boundary)
This method encodes array as thresholds, updating input array at the same time
|
OpExecutioner.ExecutionerType |
type()
This method returns type for this executioner instance
|
static void |
validateDataType(DataType expectedType,
Object op,
INDArray... operands) |
static void |
validateDataType(DataType expectedType,
Op op)
Validate the data types
for the given operation
|
protected OpExecutioner.ProfilingMode profilingMode
protected AtomicBoolean verbose
protected AtomicBoolean debug
protected void checkForCompression(Op op)
public String getLastOp()
OpExecutionergetLastOp in interface OpExecutionerprotected void interceptIntDataType(Op op)
op - public abstract INDArray exec(Op op)
OpExecutionerexec in interface OpExecutionerop - the operation to executepublic abstract INDArray exec(Op op, OpContext opContext)
OpExecutionerexec in interface OpExecutionerop - the operation to executepublic Op execAndReturn(Op op)
OpExecutionerexecAndReturn in interface OpExecutionerop - the operation to executepublic TransformOp execAndReturn(TransformOp op)
OpExecutionerexecAndReturn in interface OpExecutionerop - the operation to executepublic ReduceOp execAndReturn(ReduceOp op)
OpExecutionerexecAndReturn in interface OpExecutionerop - the operation to executepublic Variance execAndReturn(Variance op)
OpExecutionerexecAndReturn in interface OpExecutionerop - the operation to executepublic ScalarOp execAndReturn(ScalarOp op)
OpExecutionerexecAndReturn in interface OpExecutionerop - the operation to executepublic IndexAccumulation execAndReturn(IndexAccumulation op)
OpExecutionerexecAndReturn in interface OpExecutionerop - the index accumulation operation to executepublic BroadcastOp execAndReturn(BroadcastOp op)
OpExecutionerexecAndReturn in interface OpExecutionerpublic INDArray[] exec(CustomOp op)
exec in interface OpExecutionerpublic abstract INDArray exec(ReduceOp op)
OpExecutionerexec in interface OpExecutionerop - the reduceOppublic abstract INDArray exec(Variance accumulation)
OpExecutionerexec in interface OpExecutioneraccumulation - the accumulationpublic abstract INDArray exec(IndexAccumulation op)
OpExecutionerexec in interface OpExecutionerop - the index accumulation operationpublic abstract INDArray exec(BroadcastOp broadcast)
OpExecutionerexec in interface OpExecutionerbroadcast - the accumulationpublic void exec(MetaOp op)
OpExecutionerexec in interface OpExecutionerpublic void exec(GridOp op)
OpExecutionerexec in interface OpExecutionerpublic <T extends Aggregate> void exec(Batch<T> batch)
OpExecutionerexec in interface OpExecutionerpublic void exec(Aggregate op)
exec in interface OpExecutionerpublic abstract INDArray exec(ScalarOp op)
OpExecutionerexec in interface OpExecutionerpublic void exec(List<Aggregate> batch)
OpExecutionerexec in interface OpExecutionerpublic INDArray exec(RandomOp op)
exec in interface OpExecutionerop - public abstract INDArray exec(RandomOp op, Random rng)
exec in interface OpExecutionerop - rng - @Deprecated public void setProfilingMode(OpExecutioner.ProfilingMode mode)
OpExecutionersetProfilingMode in interface OpExecutionerpublic void setProfilingConfig(ProfilerConfig config)
OpExecutionersetProfilingConfig in interface OpExecutioner@Deprecated public OpExecutioner.ProfilingMode getProfilingMode()
OpExecutionergetProfilingMode in interface OpExecutioner@Deprecated public long profilingHookIn(Op op, DataBuffer... tadBuffers)
@Deprecated public long profilingHookIn(CustomOp op, OpContext oc)
@Deprecated public void profilingHookOut(Op op, OpContext oc, long timeStart)
@Deprecated public void profilingHookOut(CustomOp op, OpContext oc, long timeStart)
public long profilingConfigurableHookIn(Op op, DataBuffer... tadBuffers)
public void profilingConfigurableHookOut(Op op, OpContext oc, long timeStart)
public void profilingConfigurableHookOut(CustomOp op, OpContext oc, long timeStart)
public static void validateDataType(DataType expectedType, Op op)
expectedType - op - public static void validateDataType(DataType expectedType, Object op, INDArray... operands)
public TADManager getTADManager()
OpExecutionergetTADManager in interface OpExecutionerpublic Properties getEnvironmentInformation()
getEnvironmentInformation in interface OpExecutionerpublic void printEnvironmentInformation()
OpExecutionerprintEnvironmentInformation in interface OpExecutionerpublic void push()
OpExecutionerpush in interface OpExecutionerpublic void commit()
OpExecutionercommit in interface OpExecutionerpublic INDArray thresholdEncode(INDArray input, double threshold)
OpExecutionerthresholdEncode in interface OpExecutionerpublic INDArray thresholdEncode(INDArray input, double threshold, Integer boundary)
OpExecutionerthresholdEncode in interface OpExecutionerpublic INDArray thresholdDecode(INDArray encoded, INDArray target)
OpExecutionerthresholdDecode in interface OpExecutionerpublic long bitmapEncode(INDArray indArray, INDArray target, double threshold)
OpExecutionerbitmapEncode in interface OpExecutionerpublic INDArray bitmapEncode(INDArray indArray, double threshold)
bitmapEncode in interface OpExecutionerpublic INDArray bitmapDecode(INDArray encoded, INDArray target)
bitmapDecode in interface OpExecutionerpublic Map<String,CustomOpDescriptor> getCustomOperations()
OpExecutionergetCustomOperations in interface OpExecutionerpublic CustomOp execAndReturn(CustomOp op)
OpExecutionerexecAndReturn in interface OpExecutionerpublic List<LongShapeDescriptor> calculateOutputShape(CustomOp op)
calculateOutputShape in interface OpExecutionerpublic List<LongShapeDescriptor> calculateOutputShape(CustomOp op, OpContext opContext)
calculateOutputShape in interface OpExecutionerpublic INDArray[] allocateOutputArrays(CustomOp op)
OpExecutionerallocateOutputArrays in interface OpExecutionerpublic void enableDebugMode(boolean reallyEnable)
enableDebugMode in interface OpExecutionerpublic void enableVerboseMode(boolean reallyEnable)
enableVerboseMode in interface OpExecutionerpublic void registerGraph(long id,
org.bytedeco.javacpp.Pointer graph)
registerGraph in interface OpExecutionerpublic Map<String,INDArray> executeGraph(long id, Map<String,INDArray> map, Map<String,Integer> reverseMap)
executeGraph in interface OpExecutionerpublic void forgetGraph(long id)
forgetGraph in interface OpExecutionerpublic void setElementsThreshold(int threshold)
Default value: 1024
setElementsThreshold in interface OpExecutionerthreshold - public void setTadThreshold(int threshold)
Default value: 8
setTadThreshold in interface OpExecutionerthreshold - public boolean isVerbose()
OpExecutionerisVerbose in interface OpExecutionerpublic boolean isDebug()
OpExecutionerisDebug in interface OpExecutionerpublic OpExecutioner.ExecutionerType type()
OpExecutionertype in interface OpExecutionerpublic String getString(DataBuffer buffer, long index)
OpExecutionergetString in interface OpExecutionerpublic void scatterUpdate(ScatterUpdate.UpdateOp op, INDArray array, INDArray indices, INDArray updates, int[] axis)
OpExecutionerscatterUpdate in interface OpExecutionerpublic String opInfoString(Op op, Optional<int[]> dimensions)
op - dimensions - Use optional here for 3 states: null = "not an exec(Op, int... dim) call". empty = "exec(Op, null)".
Otherwise present = "exec(Op,int[])" callpublic boolean isExperimentalMode()
isExperimentalMode in interface OpExecutionerpublic OpContext buildContext()
OpExecutionerbuildContext in interface OpExecutionerpublic INDArray[] exec(CustomOp op, OpContext context)
OpExecutionerexec in interface OpExecutionerpublic INDArrayStatistics inspectArray(INDArray array)
inspectArray in interface OpExecutionerpublic DataBuffer createShapeInfo(long[] shape, long[] stride, long elementWiseStride, char order, DataType dtype, boolean empty)
OpExecutionercreateShapeInfo in interface OpExecutionerpublic DataBuffer createShapeInfo(long[] shape, long[] stride, long elementWiseStride, char order, DataType dtype, long extras)
createShapeInfo in interface OpExecutionerpublic TadPack tadShapeInfoAndOffsets(INDArray array, int[] dimension)
OpExecutionertadShapeInfoAndOffsets in interface OpExecutionerpublic DataBuffer createConstantBuffer(long[] values, DataType desiredType)
OpExecutionercreateConstantBuffer in interface OpExecutionerpublic DataBuffer createConstantBuffer(int[] values, DataType desiredType)
createConstantBuffer in interface OpExecutionerpublic DataBuffer createConstantBuffer(float[] values, DataType desiredType)
createConstantBuffer in interface OpExecutionerpublic DataBuffer createConstantBuffer(double[] values, DataType desiredType)
createConstantBuffer in interface OpExecutionerCopyright © 2021. All rights reserved.