Model Inference
hbDNNInferV2
Create synchronous/asynchronous inference tasks based on input parameters. For the asynchronous inference task, the caller can use the returned taskHandle across functions and threads.
- Parameter
- [out]
taskHandleTask handle pointer. - [in/out]
outputOutput of the inference task. - [in]
inputInput of the inference task. - [in]
dnnHandleDNN handle pointer.
- [out]
- Return Value
- Return
0means the API was successfully executed, otherwise the execution failed.
- Return
- If
taskHandleis set tonullptr, a synchronous task will be created, as returned by the interface, and the interface will be complete. Synchronous tasks do not support multi-core model inference. - If
*taskHandleis set tonullptr, an asynchronous task will be created, and thetaskHandlereturned by the interface can be used for subsequent blocking or callbacking. - If
*taskHandleis not null and points to a previously created but uncommitted task, a new task will be created and added to it. Multi-core tasks do not support task addition operations.
Up to 32 coexisting model tasks are supported.
hbDNNGetTaskOutputTensorProperties
Get dynamic output property information of the task that taskHandle points to.
- Parameter
- [out]
propertiesInfo of the input tensor. - [in]
taskHandleTask handle pointer. - [in]
subTaskIndexSubtask index. - [in]
outputIndexIndex of the output tensor of the subtask.
- [out]
- Return Value
- Return
0means the API was successfully executed, otherwise the execution failed.
- Return
-
If the model has dynamic output, you need to use this interface to obtain the dynamic attribute information of the task output for subsequent processing. The non-dynamic output tensor information is the same as that obtained by
hbDNNGetOutputTensorProperties. -
If the task pointed to by
taskHandlehas multiple subtasks,subTaskIndexis used to specify the subtask number. -
If the model contains dynamic output, please do not use the synchronous task execution method during inference, because the synchronously executed task cannot obtain the taskHandle.
