20#include <mio/tflite/schema_generated.h>
22#include <tflchef.pb.h>
37template <
typename DT> std::vector<DT>
extract_buffer(
const tflite::Buffer *buffer)
39 assert(buffer->data() !=
nullptr);
40 auto buffer_length = buffer->data()->size();
41 auto num_elements = buffer_length /
sizeof(DT);
42 std::vector<DT> result(num_elements);
43 std::memcpy(result.data(), buffer->data()->data(), buffer_length);
49 std::vector<T> ret(flat_array->
size());
50 for (uint32_t i = 0; i < flat_array->
size(); i++)
52 ret[i] = flat_array->
Get(i);
return_type Get(uoffset_t i) const
tflchef::MirrorPadMode as_tflchef_mirrorpadmode(const tflite::MirrorPadMode mode)
std::vector< DT > extract_buffer(const tflite::Buffer *buffer)
extract buffer data to std::vector<DT>
tflchef::Padding as_tflchef_padding(const tflite::Padding padding)
tflchef::DimensionType as_tflchef_sparse_dim_type(const tflite::DimensionType type)
std::vector< T > as_index_vector(const flatbuffers::Vector< T > *flat_array)
tflchef::SparseIndexVecType as_tflchef_sparse_idx_vec_type(const tflite::SparseIndexVector type)
tflchef::TensorType as_tflchef_type(const tflite::TensorType type)
tflchef::Activation as_tflchef_activation(const tflite::ActivationFunctionType type)