17#ifndef __ONERT_BACKEND_TRIX_CONVERT_H__
18#define __ONERT_BACKEND_TRIX_CONVERT_H__
21#include <ir/DataType.h>
24#include <libnpuhost.h>
49template <typename T, std::enable_if_t<std::is_base_of<IPortableTensor, T>::value,
bool> =
true>
52 info->num_info =
static_cast<uint32_t
>(tensors.size());
54 for (uint32_t idx = 0; idx <
info->num_info; ++idx)
56 info->info[idx].layout = DATA_LAYOUT_NHWC;
68template <typename T, std::enable_if_t<std::is_base_of<IPortableTensor, T>::value,
bool> =
true>
69void setBuffers(
const std::vector<T *> &tensors, generic_buffers *buf)
71 buf->num_buffers =
static_cast<uint32_t
>(tensors.size());
73 for (uint32_t idx = 0; idx < buf->num_buffers; ++idx)
75 buf->bufs[idx].addr = tensors[idx]->buffer();
76 buf->bufs[idx].size =
static_cast<uint64_t
>(tensors[idx]->total_size());
77 buf->bufs[idx].type = BUFFER_MAPPED;
volatile const char info[]
void setBuffers(const std::vector< T * > &tensors, generic_buffers *buf)
Set the generic_buffers object.
data_type convertDataType(const ir::DataType type)
Convert type of data from onert type to npu type.
void setDataInfo(const std::vector< T * > &tensors, tensors_data_info *info)
Set the tensors_data_info object.