copy_from_host - 3.0 English

Vitis AI User Guide (UG1414)

Document ID
UG1414
Release Date
2023-02-24
Version
3.0 English
Copy data from the source buffer.

Prototype

void copy_from_host(size_t batch_idx, const void* buf, size_t size, size_t offset);

Parameters

The following table lists the copy_from_host function arguments.
Table 1. copy_from_host Arguments
Type Name Description
size_t batch_idx The batch index
const void* buf Source buffer start address
size_t size Data size to be copied
size_t offset The start offset to be copied

Returns

None.

Usage

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