Extract CLUniqueTensor to another file (#578)
author김정현/동작제어Lab(SR)/Senior Engineer/삼성전자 <jh0822.kim@samsung.com>
Thu, 12 Apr 2018 00:44:49 +0000 (09:44 +0900)
committer박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Thu, 12 Apr 2018 00:44:49 +0000 (09:44 +0900)
This commit extracts CLUniqueTensor to another file
in order to use this class in other OpenCL NN Layers.

Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com>
src/kernel/acl/src/CLUniqueTensor.h [new file with mode: 0644]
src/kernel/acl/src/cl/Conv2D.cpp

diff --git a/src/kernel/acl/src/CLUniqueTensor.h b/src/kernel/acl/src/CLUniqueTensor.h
new file mode 100644 (file)
index 0000000..b1c487d
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef __NNFW_KERNEL_ACL_CLUNIQUETENSOR_H__
+#define __NNFW_KERNEL_ACL_CLUNIQUETENSOR_H__
+
+#include <arm_compute/runtime/CL/CLTensor.h>
+
+namespace nnfw {
+namespace kernel {
+namespace acl {
+
+class CLUniqueTensor
+{
+public:
+  CLUniqueTensor(const ::arm_compute::TensorInfo &info)
+  {
+    _tensor.allocator()->init(info);
+  }
+
+public:
+  // Both copy and move are not allowed
+  CLUniqueTensor(const CLUniqueTensor &) = delete;
+  CLUniqueTensor(CLUniqueTensor &&) = delete;
+
+public:
+  ~CLUniqueTensor()
+  {
+    _tensor.allocator()->free();
+  }
+
+public:
+  void allocate()
+  {
+    _tensor.allocator()->allocate();
+  }
+
+public:
+  ::arm_compute::CLTensor &ref(void) { return _tensor; }
+  ::arm_compute::CLTensor *ptr(void) { return &_tensor; }
+
+private:
+  ::arm_compute::CLTensor _tensor;
+};
+
+} // namespace acl
+} // namespace kernel
+} // namespace nnfw
+
+#endif //__NNFW_KERNEL_ACL_CLUNIQUETENSOR_H__
index d8afe36..4c0736d 100644 (file)
@@ -6,6 +6,7 @@
 #include "../IO_accessor.h"
 #include "../util.h"
 #include "../shape.h"
+#include "../CLUniqueTensor.h"
 
 #include <cassert>
 
@@ -125,40 +126,6 @@ namespace nnfw {
 namespace kernel {
 namespace acl {
 
-class CLUniqueTensor
-{
-public:
-  CLUniqueTensor(const ::arm_compute::TensorInfo &info)
-  {
-    _tensor.allocator()->init(info);
-  }
-
-public:
-  // Both copy and move are not allowed
-  CLUniqueTensor(const CLUniqueTensor &) = delete;
-  CLUniqueTensor(CLUniqueTensor &&) = delete;
-
-public:
-  ~CLUniqueTensor()
-  {
-    _tensor.allocator()->free();
-
-  }
-
-public:
-  void allocate()
-  {
-    _tensor.allocator()->allocate();
-  }
-
-public:
-  ::arm_compute::CLTensor &ref(void) { return _tensor; }
-  ::arm_compute::CLTensor *ptr(void) { return &_tensor; }
-
-private:
-  ::arm_compute::CLTensor _tensor;
-};
-
 // TODO move to separate file
 uint32_t getNumItems(const android::nn::Shape& shape)
 {