[Pure ACL NN Runtime] Implement Compilation (#522)
author박종현/동작제어Lab(SR)/Senior Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 10 Apr 2018 02:12:03 +0000 (11:12 +0900)
committer서상민/동작제어Lab(SR)/Senior Engineer/삼성전자 <sangmin7.seo@samsung.com>
Tue, 10 Apr 2018 02:12:03 +0000 (11:12 +0900)
This commit partially implements ANeuralNetworksCompilation_create with
partially defined ANeuralNetworksCompilation.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
tools/nnapi_bindings/bindings/pure_arm_compute/src/compilation.cc
tools/nnapi_bindings/bindings/pure_arm_compute/src/compilation.h

index 98b0722..d046f8b 100644 (file)
@@ -1,10 +1,17 @@
 #include <nnapi.h>
 
 #include "compilation.h"
+#include "model.h"
 
 ResultCode
 ANeuralNetworksCompilation_create(ANeuralNetworksModel* model, ANeuralNetworksCompilation** compilation)
 {
+  std::shared_ptr<const internal::tflite::Model> internal;
+
+  model->release(internal);
+
+  *compilation = new ANeuralNetworksCompilation(internal);
+
   return ANEURALNETWORKS_NO_ERROR;
 }
 
index 7a28742..f14f631 100644 (file)
@@ -1,8 +1,22 @@
 #ifndef __COMPILATION_H__
 #define __COMPILATION_H__
 
+#include "internal/Model.h"
+
 struct ANeuralNetworksCompilation
 {
+public:
+  ANeuralNetworksCompilation(const std::shared_ptr<const internal::tflite::Model> &model)
+    : _model{model}
+  {
+    // DO NOTHING
+  }
+
+public:
+  const internal::tflite::Model &model(void) const { return *_model; }
+
+private:
+  std::shared_ptr<const internal::tflite::Model> _model;
 };
 
 #endif