aclopExecWithHandle

Description

Calls an operator in handle mode. Dynamic-shape operators are not supported. To call dynamic-shape operators, use aclopExecuteV2 instead. 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.
  • If an operator with an unused optional input is executed, create data of the aclDataBuffer type by using the aclCreateDataBuffer(nullptr, 0) call, where aclDataBuffer does not need to be freed since it is a null pointer.

Prototype

aclError aclopExecWithHandle(aclopHandle *handle,

int numInputs,

const aclDataBuffer *const inputs[],

int numOutputs,

aclDataBuffer *const outputs[],

aclrtStream stream);

Parameters

Parameter

Input/Output

Description

handle

Input

Pointer to the operator handle.

Call aclopCreateHandle to create data of the aclopHandle type in advance.

numInputs

Input

Number of input tensors.

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.

numOutputs

Input

Number of output tensors.

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.

stream

Input

Target stream of the operator.

Returns

The value 0 indicates success, and other values indicate failure. For details, see aclError.