30 _subgraphs = model->subgraphs();
31 _buffers = model->buffers();
33 auto opcodes = model->operator_codes();
34 for (const ::tflite::OperatorCode *opcode : *
opcodes)
36 _op_codes.push_back(opcode);
42 if (buff_data !=
nullptr)
50 if (
auto *buffer = (*_buffers)[buf_idx])
52 if (
auto *array = buffer->data())
54 if (
size_t size = array->size())
56 if (buff_data !=
nullptr)
58 *buff_data =
reinterpret_cast<const uint8_t *
>(array->data());
70 uint32_t index = op->opcode_index();
71 assert(index < _op_codes.size());
72 const tflite::OperatorCode *opcode = _op_codes.at(index);
79 uint32_t index = op->opcode_index();
80 assert(index < _op_codes.size());
81 const tflite::OperatorCode *opcode = _op_codes.at(index);
85 std::ostringstream oss;
86 oss <<
"(invalid: " << index <<
")";
101 if (_subgraphs->
size() <= sgindex)
107 const tflite::SubGraph *subgraph = (*_subgraphs)[sgindex];
109 _tensors = subgraph->tensors();
110 _operators = subgraph->operators();
bool select_subgraph(uint32_t subgraph)
tflite::BuiltinOperator builtin_code(const tflite::Operator *op) const
size_t buffer_info(uint32_t buf_idx, const uint8_t **buff_data)
const std::vector< const tflite::OperatorCode * > & opcodes()
std::string opcode_name(const tflite::Operator *op) const
std::string opcode_name(const ::tflite::OperatorCode *opcode)
bool is_valid(const ::tflite::OperatorCode *opcode)
::tflite::BuiltinOperator builtin_code_neutral(const ::tflite::OperatorCode *opcode)
std::vector< T > as_index_vector(const flatbuffers::Vector< T > *flat_array)
This file contains Reader class.