Compiles and executes an operator. This API is synchronous or asynchronous. Currently, only static-shape operators are supported. The compilation options are set by using the aclSetCompileopt call.
If an operator has a constant input but aclSetTensorConst has not been called to set the constant input, call aclSetTensorPlaceMent to set the placement attribute of TensorDesc and set memType to the host memory.
aclError aclopCompileAndExecuteV2(const char *opType,
int numInputs,
aclTensorDesc *inputDesc[],
aclDataBuffer *inputs[],
int numOutputs,
aclTensorDesc *outputDesc[],
aclDataBuffer *outputs[],
aclopAttr *attr,
aclopEngineType engineType,
aclopCompileType compileFlag,
const char *opPath,
aclrtStream stream)
Parameter |
Input/Output |
Description |
|---|---|---|
opType |
Input |
Pointer to the operator type name. |
numInputs |
Input |
Number of input tensors. |
inputDesc |
Input |
Pointer array of the operator input tensor description. Call aclCreateTensorDesc to create data of the aclTensorDesc type in advance. The array length is consistent with numInputs. The elements in the inputs array match those in the inputDesc array with ordering preserved. |
inputs |
Input |
Pointer array of the operator input tensor. Call aclCreateDataBuffer to create data of the aclDataBuffer type in advance. The array length is consistent with numInputs. The elements in the inputs array match those in the inputDesc array with ordering preserved. |
numOutputs |
Input |
Number of output tensors. |
outputDesc |
Input/Output |
Pointer array of the operator output tensor description. Call aclCreateTensorDesc to create data of the aclTensorDesc type in advance. The array length is consistent with numOutputs. The elements in the outputs array match those in the outputDesc array with ordering preserved. |
outputs |
Input/Output |
Pointer array of the operator output tensor. Call aclCreateDataBuffer to create data of the aclDataBuffer type in advance. The array length is consistent with numOutputs. The elements in the outputs array match those in the outputDesc array with ordering preserved. |
attr |
Input |
Pointer to the operator attributes. Call aclopCreateAttr to create data of the aclopAttr type in advance. |
engineType |
Input |
Operator execution engine. |
compileFlag |
Input |
Operator compiled flag. typedef enum aclCompileType {
ACL_COMPILE_SYS, //The operator has been registered with GE and FE.
ACL_COMPILE_UNREGISTERED //The operator has not been registered with GE or FE. (The .py source file will be used to compile the operator. Not supported currently.)
} aclopCompileType; |
opPath |
Input |
Pointer to the path of the operator implementation file (.py), excluding the file name. Required if compileFlag = ACL_COMPILE_UNREGISTERED. |
stream |
Input |
Target stream of the operator. |
0 on success; else, failure.