Function: execute_with_handle
Applicability
Product |
Supported (√/x) |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
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.
Prototype
- C Prototype
1aclError aclopExecWithHandle(aclopHandle *handle,int numInputs,const aclDataBuffer *const inputs[],int numOutputs,aclDataBuffer *const outputs[],aclrtStream stream);
- Python Function
1ret = acl.op.execute_with_handle(handle, inputs,outputs, stream)
Parameter Description
Parameter |
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 Description
Return Value |
Description |
|---|---|
ret |
Int, error code: 0 on success; else, failure. |
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.