[Pure CL] Inheric nnfw::utils::tensor::Shape (#1438)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 30 May 2018 10:53:59 +0000 (19:53 +0900)
committer오형석/동작제어Lab(SR)/Senior Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 30 May 2018 10:53:59 +0000 (19:53 +0900)
This commit revises internal::tflite::operand::Shape to inherit
nnfw::utils::tensor::Shape (to reduce code duplication).

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
runtimes/pure_arm_compute/src/internal/Model.cc
runtimes/pure_arm_compute/src/internal/Model.h

index cd0e06d..04b2d8e 100644 (file)
@@ -9,7 +9,10 @@ namespace tflite
 namespace operand
 {
 
-Shape::Shape(uint32_t rank) { _dims.resize(rank); }
+Shape::Shape(uint32_t rank) : nnfw::util::tensor::Shape(rank)
+{
+  // DO NOTHING
+}
 
 int32_t Shape::asVector(void) const
 {
index 1750f92..c5e1e1e 100644 (file)
@@ -32,6 +32,7 @@ private:
 
 #include "util/feature/Shape.h"
 #include "util/kernel/Shape.h"
+#include "util/tensor/Shape.h"
 
 namespace internal
 {
@@ -40,25 +41,15 @@ namespace tflite
 namespace operand
 {
 
-struct Shape
+struct Shape : public nnfw::util::tensor::Shape
 {
 public:
   Shape(uint32_t rank);
 
 public:
-  uint32_t rank(void) const { return _dims.size(); }
-
-public:
-  int32_t dim(uint32_t n) const { return _dims.at(n); }
-  int32_t &dim(uint32_t n) { return _dims.at(n); }
-
-public:
   int32_t asVector(void) const;
   nnfw::util::feature::Shape asFeature(void) const;
   nnfw::util::kernel::Shape asKernel(void) const;
-
-private:
-  std::vector<int32_t> _dims;
 };
 
 } // namespace operand