20#include <mio/circle/schema_generated.h>
22#include <circlechef.pb.h>
34template <
typename DT> std::vector<DT>
extract_buffer(
const circle::Buffer *buffer)
36 auto buffer_length = buffer->data()->size();
37 auto num_elements = buffer_length /
sizeof(DT);
38 std::vector<DT> result(num_elements);
39 std::memcpy(result.data(), buffer->data()->data(), buffer_length);
45 if (flat_array ==
nullptr)
46 throw std::runtime_error(
"flat_array is nullptr");
48 std::vector<T> ret(flat_array->
size());
49 for (uint32_t i = 0; i < flat_array->
size(); i++)
51 ret[i] = flat_array->
Get(i);
return_type Get(uoffset_t i) const
std::vector< T > as_index_vector(const flatbuffers::Vector< T > *flat_array)
circlechef::Activation as_circlechef_activation(const circle::ActivationFunctionType type)
std::vector< DT > extract_buffer(const circle::Buffer *buffer)
extract buffer data to std::vector<DT>
circlechef::TensorType as_circlechef_type(const circle::TensorType type)
circlechef::Padding as_circlechef_padding(const circle::Padding padding)