Executes an operator synchronously or asynchronously.
As the inputs and outputs of each operator are organized differently, the app needs to organize operators in strict accordance with their input and output parameters. When aclopExecuteV2 is called, AscendCL searches for the corresponding task based on the optype, input tensor description, output tensor description, and operator attributes, and then executes the operator.
The constant input passed to the aclopCompile and aclopExecuteV2 calls must be consistent.
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 aclopExecuteV2(const char *opType,
int numInputs,
aclTensorDesc *inputDesc[],
aclDataBuffer *inputs[],
int numOutputs,
aclTensorDesc *outputDesc[],
aclDataBuffer *outputs[],
aclopAttr *attr,
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 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 input tensors. 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 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 |
Output |
Pointer array of the output tensors. 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. |
stream |
Input |
Target stream of the operator. |
0 on success; else, failure.
For details about the API call sequence and example, see Single-Operator Execution.