summaryrefslogtreecommitdiff
path: root/compiler/tflite2circle/include/TFLModel.h
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/tflite2circle/include/TFLModel.h')
-rw-r--r--compiler/tflite2circle/include/TFLModel.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/compiler/tflite2circle/include/TFLModel.h b/compiler/tflite2circle/include/TFLModel.h
new file mode 100644
index 000000000..e53d62749
--- /dev/null
+++ b/compiler/tflite2circle/include/TFLModel.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFL_MODEL_H__
+#define __TFL_MODEL_H__
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+
+#include <mio/tflite/schema_generated.h>
+
+namespace tflite2circle
+{
+
+class TFLModel
+{
+private:
+ using DataBuffer = std::vector<char>;
+
+public:
+ TFLModel(void) = delete;
+ TFLModel(const std::string &path);
+
+public:
+ bool is_valid(void) { return _valid; }
+
+private:
+ const tflite::Model *load_model(void);
+
+private:
+ std::ifstream _infile;
+ DataBuffer _data;
+ bool _valid;
+
+ friend class CircleModel;
+};
+
+} // namespace tflite2circle
+
+#endif // __TFL_MODEL_H__