copy_to_host - 3.0 简体中文

Vitis AI 用户指南 (UG1414)

Document ID
UG1414
Release Date
2023-02-24
Version
3.0 简体中文
将数据复制到目标缓冲区。

原型设计

void copy_to_host(size_t batch_idx, void* buf, size_t size, size_t offset);

参数

下表列出了 copy_to_host 函数实参。
表 1. copy_to_host Arguments
类型 名称 描述
size_t batch_idx 批次索引
void* buf 目标缓冲区起始地址
size_t size 要复制的数据大小
size_t offset 要复制的起始偏移

返回

无。

用法

vart::TensorBuffer* tb_from;
vart::TensorBuffer* tb_to;
for (auto batch = 0u; batch < batch_size; ++batch) {
       std::tie(data, tensor_size) = tb_to->data({(int)batch, 0, 0, 0});
    tb_from->copy_to_host(batch, reinterpret_cast<void*>(data),
                        tensor_size, 0u);
}