C++ APIs - 2.0 English

Vitis AI User Guide (UG1414)

Document ID
UG1414
Release Date
2022-01-20
Version
2.0 English

Class 1

The class name is vart::Runner. The following table lists all the functions defined in the vitis::vart::Runner class.

Table 1. Quick Function Reference
Return Type Name Arguments
std::unique_ptr<Runner> create_runner const xir::Subgraph* subgraph

const std::string& mode

std::vector<std::unique_ptr<Runner>> create_runner const std::string& model_directory
std::pair<uint32_t, int> execute_async const std::vector<TensorBuffer*>& input

const std::vector<TensorBuffer*>& output

int wait int jobID

int timeout

TensorFormat get_tensor_format  
std::vector<const xir::Tensor*> get_input_tensors  
std::vector<const xir::Tensor*> get_output_tensors  

For vart::Runner example, refer to vart::Runner Example

Class 2

The class name is vart::TensorBuffer. The following table lists all the functions defined in the vart::TensorBuffer class.

Table 2. Quick Function Reference
Return Type Name Arguments
location_t get_location  
const xir::Tensor* get_tensor  
std::pair<std::uint64_t, std::size_t> data const std::vector<std::int32_t> idx = {}
std::pair<uint64_t, size_t> data_phy const std::vector<std::int32_t> idx
void sync_for_read uint64_t offset, size_t size
void sync_for_write uint64_t offset, size_t size
void copy_from_host size_t batch_idx, const void* buf, size_t size, size_t offset
void copy_to_host size_t batch_idx, void* buf, size_t size, size_t offset
void copy_tensor_buffer

vart::TensorBuffer* tb_from,

vart::TensorBuffer* tb_to

Class 3

The class name is vart::RunnerExt. The following table lists all the functions defined in the vart::RunnerExt class.

Table 3. Quick Function Reference
Return Type Name Arguments
std::vector<vart::TensorBuffer*> get_inputs  
std::vector<vart::TensorBuffer*> get_outputs  

Class 4

The class name is vitis::ai::GraphRunner. The following table lists all the functions defined in the vitis::ai::GraphRunner class.

Table 4. Quick Function Reference
Return Type Name Arguments
std::unique_ptr<vart::RunnerExt> create_graph_runner const xir::Graph* graph, xir::Attrs* attrs

For graph_runner example, refer to Graph runner Example