Function: execute

Applicable Products

  • Ascend 950PR&950DT products: Not supported
  • Atlas A3 products: Supported
  • Atlas A2 products: Supported
  • Atlas 200I/500 A2 inference products: Supported
  • Atlas inference products: Supported
  • Atlas training products: Supported

Function

Executes a specified operator. This is an asynchronous API.

NOTE

This API will be deprecated in later versions. Use the acl.op.execute_v2 API instead.

Prototype

  • C 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)
    
  • Python Function

    ret = acl.op.execute(op_type, input_desc, inputs, output_desc, outputs, attr,stream)
    

Parameters

Parameter Description
op_type Str, operator type.
input_desc Int list, description of the operator input tensor. It contains multiple ACL tensor description address objects.
inputs Int list, input tensor of the operator. It contains multiple aclDataBuffer data address objects.
output_desc Int list, description of the operator output tensor. It contains multiple ACL tensor description address objects.
outputs Int list, output tensor of the operator. It contains multiple aclDataBuffer data address objects.
attr Int, attribute address object of the operator.
stream Int, stream object to be loaded by the operator.

Return Values

Return Value Description
ret Int, error code: 0 on success; else, failure.

Constraints

  • This API is asynchronous. A successful call indicates only that the task has been delivered, not that it has completed. After this API is called, call the synchronization API (for example, acl.rt.synchronize_stream) to ensure that the task is complete.
  • In multi-thread scenarios, this API cannot be called to specify the same stream or the default stream. Otherwise, exceptions may occur in task execution.
  • 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 acl.op.execute is called, it searches for the corresponding task based on the operator type, input tensor description, output tensor description, and attribute information, and delivers the task for execution.