Enable other types for class View (#1520)
author장지섭/동작제어Lab(SR)/Engineer/삼성전자 <jiseob.jang@samsung.com>
Mon, 4 Jun 2018 02:47:33 +0000 (11:47 +0900)
committer이춘석/동작제어Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Mon, 4 Jun 2018 02:47:33 +0000 (11:47 +0900)
This commit enables other types for class View.

Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
runtimes/pure_arm_compute/src/internal/arm_compute/feature/View.h
runtimes/pure_arm_compute/src/internal/arm_compute/kernel/View.h

index a3857da..f22c33c 100644 (file)
@@ -14,9 +14,7 @@ namespace arm_compute
 namespace feature
 {
 
-template <typename T> class View;
-
-template <> class View<float> final : public nnfw::util::feature::Reader<float>
+template <typename T> class View final : public nnfw::util::feature::Reader<T>
 {
 public:
   View(::arm_compute::ITensor *tensor) : _tensor{tensor}
@@ -34,21 +32,21 @@ public:
   const ::nnfw::util::feature::Shape &shape(void) const { return _shape; }
 
 public:
-  float at(uint32_t ch, uint32_t row, uint32_t col) const override
+  T at(uint32_t ch, uint32_t row, uint32_t col) const override
   {
     const auto offset = feature_index_to_byte_offset(ch, row, col);
 
-    float *ptr = reinterpret_cast<float *>(_tensor->buffer() + offset);
+    T *ptr = reinterpret_cast<T *>(_tensor->buffer() + offset);
 
     return *ptr;
   }
 
 public:
-  float &at(uint32_t ch, uint32_t row, uint32_t col)
+  T &at(uint32_t ch, uint32_t row, uint32_t col)
   {
     const auto offset = feature_index_to_byte_offset(ch, row, col);
 
-    float *ptr = reinterpret_cast<float *>(_tensor->buffer() + offset);
+    T *ptr = reinterpret_cast<T *>(_tensor->buffer() + offset);
 
     return *ptr;
   }
index 1ad47b6..dd95f9a 100644 (file)
@@ -15,9 +15,7 @@ namespace arm_compute
 namespace kernel
 {
 
-template <typename T> class View;
-
-template <> class View<float> final : public nnfw::util::kernel::Reader<float>
+template <typename T> class View final : public nnfw::util::kernel::Reader<T>
 {
 public:
   View(::arm_compute::ITensor *tensor) : _tensor{tensor}
@@ -34,21 +32,21 @@ public:
   const ::nnfw::util::kernel::Shape &shape(void) const { return _shape; }
 
 public:
-  float at(uint32_t nth, uint32_t ch, uint32_t row, uint32_t col) const override
+  T at(uint32_t nth, uint32_t ch, uint32_t row, uint32_t col) const override
   {
     const auto offset = kernel_index_to_byte_offset(nth, ch, row, col);
 
-    float *ptr = reinterpret_cast<float *>(_tensor->buffer() + offset);
+    T *ptr = reinterpret_cast<T *>(_tensor->buffer() + offset);
 
     return *ptr;
   }
 
 public:
-  float &at(uint32_t nth, uint32_t ch, uint32_t row, uint32_t col)
+  T &at(uint32_t nth, uint32_t ch, uint32_t row, uint32_t col)
   {
     const auto offset = kernel_index_to_byte_offset(nth, ch, row, col);
 
-    float *ptr = reinterpret_cast<float *>(_tensor->buffer() + offset);
+    T *ptr = reinterpret_cast<T *>(_tensor->buffer() + offset);
 
     return *ptr;
   }