$(info $(shell ($(NNTRAINER_JNI_ROOT)/prepare_tflite.sh $(TENSORFLOW_VERSION) $(NDK_LIBS_OUT))))
+$(info $(shell (flatc -c $(NNTRAINER_ROOT)/nntrainer/compiler/tf_schema.fbs)))
+$(info $(shell (mv tf_scehma_generated.h $(NNTRAINER_ROOT)/nntrainer/compiler)))
+
endif #MAKECMDGOALS
endif #TENSORFLOW_ROOT
$(NNTRAINER_ROOT)/nntrainer/dataset/databuffer_factory.cpp \
$(NNTRAINER_ROOT)/nntrainer/dataset/databuffer_func.cpp \
$(NNTRAINER_ROOT)/nntrainer/dataset/databuffer_file.cpp \
- $(NNTRAINER_ROOT)/nntrainer/compiler/ini_interpreter.cpp \
$(NNTRAINER_ROOT)/nntrainer/tensor/tensor.cpp \
$(NNTRAINER_ROOT)/nntrainer/tensor/lazy_tensor.cpp \
$(NNTRAINER_ROOT)/nntrainer/tensor/manager.cpp \
$(NNTRAINER_ROOT)/nntrainer/utils/parse_util.cpp \
$(NNTRAINER_ROOT)/nntrainer/utils/profiler.cpp \
$(NNTRAINER_ROOT)/nntrainer/utils/node_exporter.cpp \
+ $(NNTRAINER_ROOT)/nntrainer/compiler/ini_interpreter.cpp \
+ $(NNTRAINER_ROOT)/nntrainer/compiler/tflite_interpreter.cpp \
$(NNTRAINER_ROOT)/nntrainer/app_context.cpp
# Add tflite backbone building
command: [flatc, '-c', '@INPUT@'])
nntrainer_sources += flat_header
+ compiler_sources += 'tflite_interpreter.cpp'
endif
foreach s : compiler_sources
--- /dev/null
+// SPDX-License-Identifier: Apache-2.0
+/**
+ * Copyright (C) 2021 Jihoon Lee <jhoon.it.lee@samsung.com>
+ *
+ * @file tflite_interpreter.cpp
+ * @date 12 April 2021
+ * @brief NNTrainer *.tflite Interpreter
+ * @see https://github.com/nnstreamer/nntrainer
+ * @author Jihoon Lee <jhoon.it.lee@samsung.com>
+ * @bug No known bugs except for NYI items
+ */
+#include <tflite_interpreter.h>
+
+#include <tf_schema_generated.h>
+
+namespace nntrainer {
+
+void TfliteInterpreter::serialize(
+ std::shared_ptr<const GraphRepresentation> representation,
+ const std::string &out) {
+ /** NYI!! */
+}
+
+std::shared_ptr<GraphRepresentation>
+TfliteInterpreter::deserialize(const std::string &in) { /** NYI! */
+ return nullptr;
+}
+
+} // namespace nntrainer
* @author Jihoon Lee <jhoon.it.lee@samsung.com>
* @bug No known bugs except for NYI items
*/
+#ifndef __TFLITE_INTERPRETER_H__
+#define __TFLITE_INTERPRETER_H__
-#include <tf_schema_generated.h>
+#include <interpreter.h>
+
+#include <app_context.h>
+namespace nntrainer {
+
+/**
+ * @brief tflite graph interpreter class
+ *
+ */
+class TfliteInterpreter : public GraphInterpreter {
+public:
+ /**
+ * @brief Construct a new tflite Graph Interpreter object
+ *
+ * @param app_context_ app context to create layers
+ */
+ TfliteInterpreter(const AppContext &app_context_ = AppContext::Global()) :
+ app_context(app_context_) {}
+
+ /**
+ * @brief Destroy the Tflite Interpreter object
+ *
+ */
+ virtual ~TfliteInterpreter() = default;
+
+ /**
+ * @copydoc GraphInterpreter::serialize(const std::string &out)
+ */
+ void serialize(std::shared_ptr<const GraphRepresentation> representation,
+ const std::string &out) override;
+
+ /**
+ * @copydoc GraphInterpreter::deserialize(const std::string &in)
+ */
+ std::shared_ptr<GraphRepresentation>
+ deserialize(const std::string &in) override;
+
+private:
+ AppContext app_context;
+};
+
+} // namespace nntrainer
+
+#endif // __TFLITE_INTERPRETER_H__