Python APIs
Class 1
The class name is vart.Runner. The following table lists all the functions defined in the vart.Runner class.
Type | Name | Arguments |
---|---|---|
vart.Runner | create_runner | xir.Subgraph subgraph string mode |
List[xir.Tensor] | get_input_tensors | |
List[xir.Tensor] | get_output_tensors | |
tuple[uint32, int] | execute_async | List[vart.TensorBuffer] inputs List[vart.TensorBuffer] outputs Note: vart.TensorBuffer complete with buffer protocol . |
int | wait | tuple[uint32, int] jobID |
Class 2
The class name is vart.RunnerExt. The following table lists all the functions defined
in the vart.RunnerExt
class.
vart.RunnerExt extends from
vart.Runner
.
Type | Name | Arguments |
---|---|---|
vart.RunnerExt | create_runner | xir.Subgraph subgraph String mode |
List[vart.TensorBuffer] | get_inputs | |
List[vart.TensorBuffer] | get_outputs |
Class 3
The class name is vitis_ai_library.GraphRunner. The following table lists all the
functions defined in the vitis_ai_library.GraphRunner
class.
Type | Name | Arguments |
---|---|---|
vart.RunnerExt | create_graph_runner | xir.Graph graph |
create_runner
Creates an instance of DPU runner by subgraph. This is a factory function.
Prototype
vart.Runner create_runner(xir.Subgraph subgraph, String mode)
Parameters
The following table lists the create_runner function arguments.
Type | Name | Description |
---|---|---|
xir.Subgraph | subgraph | XIR Subgraph |
String | mode | 'run' - DPU runner |
Returns
An instance of DPU runner.
execute_async
Executes the runner. This is a block function.
Prototype
tuple[uint32_t, int] execute_async(
List[vart.TensorBuffer] inputs,
List[vart.TensorBuffer] outputs)
Parameters
The following table lists the execute_async function arguments.
Type | Name | Description |
---|---|---|
List[vart.TensorBuffer] | inputs | A list of vart.TensorBuffer containing the input data for inference. |
List[vart.TensorBuffer] | outputs | A list of vart.TensorBuffer which will be filled with output data. |
Returns
tuple[jobID, status] status 0 for exit successfully, others for customized warnings or errors.
wait
Waits for the end of DPU processing. This is a block function.
Prototype
int wait(tuple[uint32_t, int] jobid)
Parameters
The following table lists the wait function arguments.
Type | Name | Description |
---|---|---|
tuple[uint32_t, int] | jobid | job id |
Returns
Status 0 for exit successfully, others for customized warnings or errors.
get_input_tensors
Gets all input tensors of runner.
Prototype
List[xir.Tensor] get_input_tensors()
Parameters
None
Returns
All input tensors. A vector of raw pointer to the input tensor.
get_output_tensors
Gets all output tensors of runner.
Prototype
List[xir.Tensor] get_output_tensors()
Parameters
None
Returns
All output tensors. A vector of raw pointer to the output tensor.
get_inputs
Prototype
List[vart.TensorBuffer] get_inputs()
Parameters
None.Returns
All input TensorBuffers. A vector of raw pointer to the input TensorBuffer.get_outputs
Prototype
List[vart.TensorBuffer] get_outputs()
Parameters
None.Returns
All output TensorBuffers. A vector of raw pointer to the output TensorBuffer.create_graph_runner
Factory function to create an instance of runner by graph.
Prototype
vart.RunnerExt create_graph_runner(xir.Graph graph)
Parameters
The following table lists the create_graph_runner function arguments.
Type | Name | Description |
---|---|---|
xir.Graph | graph | XIR Graph |
Returns
An instance of runner.