aclopExecute (Deprecated)
This API will be deprecated in future releases. Use aclopExecuteV2 instead.
Description
Executes a specified operator. This API is asynchronous.
Restrictions
- This API is asynchronous. The API call delivers a task rather than executes a task. After this API is called, you need to call a synchronization API (for example, aclrtSynchronizeStream) to ensure that the task is complete. Otherwise, service exceptions (such as training or inference exception) or unknown situations (such as device link or card disconnection) may occur.
- In multi-thread scenarios, you cannot specify the same stream or use the default stream when calling this API. Otherwise, the task execution may be abnormal.
- As the inputs, outputs, and attributes of each operator are different, the app needs to organize operators in strict accordance with their inputs, outputs, and attributes. When aclopExecute is called, AscendCL searches for the corresponding task based on the operator type, input tensor description, output tensor description, and operator attributes, and then executes the operator.
Prototype
aclError aclopExecute(const char *opType,
int numInputs,
const aclTensorDesc *const inputDesc[],
const aclDataBuffer *const inputs[],
int numOutputs,
const aclTensorDesc *const outputDesc[],
aclDataBuffer *const outputs[],
const aclopAttr *attr,
aclrtStream stream)
Parameters
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. |
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. |
numOutputs |
Input |
Number of output tensors. The array length is consistent with numOutputs. |
outputDesc |
Input |
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. |
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. |
Returns
The value 0 indicates success, and other values indicate failure. For details, see aclError.