From 2cceebf5b48374124712a0fccecd0fe631f8acdd Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9E=A5=EC=A7=80=EC=84=AD/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84?= =?utf8?q?=EC=9E=90?= Date: Mon, 4 Jun 2018 11:47:33 +0900 Subject: [PATCH] Enable other types for class View (#1520) This commit enables other types for class View. Signed-off-by: jiseob.jang --- .../pure_arm_compute/src/internal/arm_compute/feature/View.h | 12 +++++------- .../pure_arm_compute/src/internal/arm_compute/kernel/View.h | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/runtimes/pure_arm_compute/src/internal/arm_compute/feature/View.h b/runtimes/pure_arm_compute/src/internal/arm_compute/feature/View.h index a3857da..f22c33c 100644 --- a/runtimes/pure_arm_compute/src/internal/arm_compute/feature/View.h +++ b/runtimes/pure_arm_compute/src/internal/arm_compute/feature/View.h @@ -14,9 +14,7 @@ namespace arm_compute namespace feature { -template class View; - -template <> class View final : public nnfw::util::feature::Reader +template class View final : public nnfw::util::feature::Reader { 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(_tensor->buffer() + offset); + T *ptr = reinterpret_cast(_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(_tensor->buffer() + offset); + T *ptr = reinterpret_cast(_tensor->buffer() + offset); return *ptr; } diff --git a/runtimes/pure_arm_compute/src/internal/arm_compute/kernel/View.h b/runtimes/pure_arm_compute/src/internal/arm_compute/kernel/View.h index 1ad47b6..dd95f9a 100644 --- a/runtimes/pure_arm_compute/src/internal/arm_compute/kernel/View.h +++ b/runtimes/pure_arm_compute/src/internal/arm_compute/kernel/View.h @@ -15,9 +15,7 @@ namespace arm_compute namespace kernel { -template class View; - -template <> class View final : public nnfw::util::kernel::Reader +template class View final : public nnfw::util::kernel::Reader { 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(_tensor->buffer() + offset); + T *ptr = reinterpret_cast(_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(_tensor->buffer() + offset); + T *ptr = reinterpret_cast(_tensor->buffer() + offset); return *ptr; } -- 2.7.4