Function: execute_with_handle

C Prototype

aclError aclopExecWithHandle(aclopHandle *handle, int numInputs, const aclDataBuffer *const inputs[], int numOutputs, aclDataBuffer *const outputs[], aclrtStream stream);

Python Function

ret = acl.op.execute_with_handle(handle, inputs,outputs, stream)

Function Usage

Calls an operator in handle mode. Dynamic-shape operators are not supported. To call dynamic-shape operators, use acl.op.execute_v2 instead. This API is asynchronous.

Input Description

handle: int, handle of the operator to be executed. It is a pointer address.

Call acl.op.create_handle to create data of the aclopHandle type in advance.

inputs: int list, input tensor of the operator. It contains multiple aclDataBuffer data address objects.

Call acl.create_data_buffer to create data of the aclDataBuffer type in advance.

outputs: int list, output tensor of the operator. It contains multiple aclDataBuffer data address objects.

Call acl.create_data_buffer to create data of the aclDataBuffer type in advance.

stream: int, stream where the operator is executed, stream address object.

Return Value

ret: int, error code.

Restrictions

  • This API is asynchronous. The API call delivers a task rather than executes a task. 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.
  • When executing an operator with optional input, if the optional input is not used, create data of the aclDataBuffer type as follows:
    acl.create_data_buffer(nullptr, 0)

    In addition, the data in aclDataBuffer does not need to be released because it is an empty data type.