17#ifndef __TFLREAD_READ_H__
18#define __TFLREAD_READ_H__
20#include <mio/tflite/schema_generated.h>
31 std::vector<T> ret(flat_array->
size());
32 for (uint32_t i = 0; i < flat_array->
size(); i++)
34 ret[i] = flat_array->
Get(i);
53 Reader(
const tflite::Model *model);
54 Reader(
const tflite::Model *model,
const std::vector<char> *rawdata);
59 uint32_t
version()
const {
return _version; }
61 const std::vector<const tflite::OperatorCode *> &
opcodes() {
return _op_codes; }
65 const std::vector<int32_t> &
inputs()
const {
return _inputs; }
66 const std::vector<int32_t> &
outputs()
const {
return _outputs; }
72 size_t buffer_info(uint32_t buf_idx,
const uint8_t **buff_data);
73 size_t buffer_info(uint32_t buf_idx,
const uint8_t **buff_data,
bool &ext_offset);
74 tflite::BuiltinOperator
builtin_code(
const tflite::Operator *op)
const;
75 std::string
opcode_name(
const tflite::Operator *op)
const;
85 const std::vector<char> *_rawdata{
nullptr};
87 const TFliteSubGraphs_t *_subgraphs{
nullptr};
88 const TFliteBuffers_t *_buffers{
nullptr};
89 const TFliteTensors_t *_tensors{
nullptr};
90 const TFliteOperators_t *_operators{
nullptr};
91 const TFliteMetadata_t *_metadata{
nullptr};
92 const TFliteSignatureDef_t *_signaturedefs{
nullptr};
94 uint32_t _subgraph_index;
95 std::string _subgraph_name;
96 std::vector<const tflite::OperatorCode *> _op_codes;
97 std::vector<int32_t> _inputs;
98 std::vector<int32_t> _outputs;
return_type Get(uoffset_t i) const
Loads TF lite file and provides helpers to access attributes.
uint32_t num_subgraph() const
const TFliteOperators_t * operators()
const std::vector< const tflite::OperatorCode * > & opcodes()
tflite::BuiltinOperator builtin_code(const tflite::Operator *op) const
const std::vector< int32_t > & inputs() const
size_t buffer_info(uint32_t buf_idx, const uint8_t **buff_data)
const TFliteBuffers_t * buffers()
uint32_t subgraph_index(void) const
const std::vector< int32_t > & outputs() const
bool select_subgraph(uint32_t subgraph)
const TFliteSignatureDef_t * signaturedefs() const
const TFliteTensors_t * tensors()
const std::string & subgraph_name(void) const
std::string opcode_name(const tflite::Operator *op) const
const TFliteMetadata_t * metadata() const
std::vector< T > as_index_vector(const flatbuffers::Vector< T > *flat_array)