Path: blob/master/examples/cpptflite/src/TfliteBase.h
1559 views
#ifndef TFLITEBASE_H1#define TFLITEBASE_H23#include "tensorflow/lite/interpreter.h"4#include "tensorflow/lite/kernels/register.h"5#include "tensorflow/lite/model.h"6#include "tensorflow/lite/optional_debug_tools.h"78#define TFLITE_MINIMAL_CHECK(x) \9if (!(x)) { \10fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); \11exit(1); \12}1314typedef struct15{16float *melData;17std::vector<int32_t> melShape;18int32_t bytes;19} MelGenData;2021class TfliteBase22{23public:24uint32_t int_size = sizeof(int32_t);25uint32_t float_size = sizeof(float);2627std::unique_ptr<tflite::Interpreter> interpreter;2829TfliteBase(const char* modelFilename);30~TfliteBase();3132private:33std::unique_ptr<tflite::FlatBufferModel> model;34tflite::ops::builtin::BuiltinOpResolver resolver;3536void interpreterBuild(const char* modelFilename);37};3839#endif // TFLITEBASE_H4041