From a8aebdce73d14752af867841c7602bef5c582ce0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9E=A5=EC=A7=80=EC=84=AD/On-Device=20Lab=28SR=29/Enginee?= =?utf8?q?r/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Fri, 23 Aug 2019 08:08:14 +0900 Subject: [PATCH] Make backend::operand::ITensor::calcOffset to const member function (#6825) This commit makes backend::operand::ITensor::calcOffset to const member function. Signed-off-by: jiseob.jang --- runtimes/neurun/backend/acl_common/IACLTensor.cc | 2 +- runtimes/neurun/backend/acl_common/IACLTensor.h | 2 +- runtimes/neurun/backend/cpu/operand/Tensor.cc | 2 +- runtimes/neurun/backend/cpu/operand/Tensor.h | 2 +- runtimes/neurun/core/include/backend/operand/ITensor.h | 2 +- runtimes/neurun/core/src/exec/interp/Tensor.cc | 4 ++-- runtimes/neurun/core/src/exec/interp/Tensor.h | 6 +++--- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/runtimes/neurun/backend/acl_common/IACLTensor.cc b/runtimes/neurun/backend/acl_common/IACLTensor.cc index 26ef071..cfddc1b 100644 --- a/runtimes/neurun/backend/acl_common/IACLTensor.cc +++ b/runtimes/neurun/backend/acl_common/IACLTensor.cc @@ -40,7 +40,7 @@ size_t IACLTensor::dimension(size_t index) const return info()->dimension(reversed.value()); } -size_t IACLTensor::calcOffset(const neurun::util::Coordinates &coords) +size_t IACLTensor::calcOffset(const neurun::util::Coordinates &coords) const { const auto rank = coords.size(); ::arm_compute::Coordinates acl_coords; diff --git a/runtimes/neurun/backend/acl_common/IACLTensor.h b/runtimes/neurun/backend/acl_common/IACLTensor.h index bfda841..1dc79f4 100644 --- a/runtimes/neurun/backend/acl_common/IACLTensor.h +++ b/runtimes/neurun/backend/acl_common/IACLTensor.h @@ -41,7 +41,7 @@ public: size_t total_size() const final { return info()->total_size(); } size_t dimension(size_t index) const final; size_t num_dimensions() const override; - size_t calcOffset(const neurun::util::Coordinates &coords) final; + size_t calcOffset(const neurun::util::Coordinates &coords) const final; model::Layout layout() const final; bool has_padding() const override { return info()->has_padding(); } diff --git a/runtimes/neurun/backend/cpu/operand/Tensor.cc b/runtimes/neurun/backend/cpu/operand/Tensor.cc index 106e069..29e6eb8 100644 --- a/runtimes/neurun/backend/cpu/operand/Tensor.cc +++ b/runtimes/neurun/backend/cpu/operand/Tensor.cc @@ -25,7 +25,7 @@ namespace cpu namespace operand { -size_t Tensor::calcOffset(const neurun::util::Coordinates &coords) +size_t Tensor::calcOffset(const neurun::util::Coordinates &coords) const { size_t rank = num_dimensions(); size_t offset = 0; diff --git a/runtimes/neurun/backend/cpu/operand/Tensor.h b/runtimes/neurun/backend/cpu/operand/Tensor.h index 07ce11f..d0bfbf3 100644 --- a/runtimes/neurun/backend/cpu/operand/Tensor.h +++ b/runtimes/neurun/backend/cpu/operand/Tensor.h @@ -59,7 +59,7 @@ public: size_t dimension(size_t index) const override { return _info.shape().dim(index); } size_t num_dimensions() const override { return _info.shape().rank(); } size_t total_size() const override { return _info.total_size(); } - size_t calcOffset(const neurun::util::Coordinates &coords) override; + size_t calcOffset(const neurun::util::Coordinates &coords) const override; model::Layout layout() const override { return model::Layout::NHWC; } bool has_padding() const override { return false; } diff --git a/runtimes/neurun/core/include/backend/operand/ITensor.h b/runtimes/neurun/core/include/backend/operand/ITensor.h index 63243eb..f762ad0 100644 --- a/runtimes/neurun/core/include/backend/operand/ITensor.h +++ b/runtimes/neurun/core/include/backend/operand/ITensor.h @@ -40,7 +40,7 @@ public: virtual size_t total_size() const = 0; virtual size_t dimension(size_t index) const = 0; virtual size_t num_dimensions() const = 0; - virtual size_t calcOffset(const neurun::util::Coordinates &coords) = 0; + virtual size_t calcOffset(const neurun::util::Coordinates &coords) const = 0; virtual model::Layout layout() const = 0; virtual bool has_padding() const = 0; }; diff --git a/runtimes/neurun/core/src/exec/interp/Tensor.cc b/runtimes/neurun/core/src/exec/interp/Tensor.cc index ea71d85..becb737 100644 --- a/runtimes/neurun/core/src/exec/interp/Tensor.cc +++ b/runtimes/neurun/core/src/exec/interp/Tensor.cc @@ -25,13 +25,13 @@ namespace exec namespace interp { -size_t ROTensor::calcOffset(const neurun::util::Coordinates &coords) +size_t ROTensor::calcOffset(const neurun::util::Coordinates &coords) const { NO_USE(coords); throw std::runtime_error("offset_element_in_bytes is not supported for cpu::Tensor now."); } -size_t Tensor::calcOffset(const neurun::util::Coordinates &coords) +size_t Tensor::calcOffset(const neurun::util::Coordinates &coords) const { NO_USE(coords); throw std::runtime_error("offset_element_in_bytes is not supported for cpu::Tensor now."); diff --git a/runtimes/neurun/core/src/exec/interp/Tensor.h b/runtimes/neurun/core/src/exec/interp/Tensor.h index 90642ac..c8237de 100644 --- a/runtimes/neurun/core/src/exec/interp/Tensor.h +++ b/runtimes/neurun/core/src/exec/interp/Tensor.h @@ -74,7 +74,7 @@ public: virtual size_t total_size() const = 0; virtual size_t dimension(size_t index) const = 0; virtual size_t num_dimensions() const = 0; - virtual size_t calcOffset(const util::Coordinates &coords) = 0; + virtual size_t calcOffset(const util::Coordinates &coords) const = 0; virtual bool has_padding() const = 0; /** @@ -121,7 +121,7 @@ public: size_t total_size() const override { return _info.total_size(); } size_t dimension(size_t index) const override { return _info.shape().dim(index); } size_t num_dimensions() const override { return _info.shape().rank(); } - size_t calcOffset(const util::Coordinates &coords) override; + size_t calcOffset(const util::Coordinates &coords) const override; model::Layout layout() const override; bool has_padding() const override { return false; } model::DataType data_type() const override { return _info.typeInfo().type(); } @@ -160,7 +160,7 @@ public: size_t total_size() const override { return _info.total_size(); } size_t dimension(size_t index) const override { return _info.shape().dim(index); } size_t num_dimensions() const override { return _info.shape().rank(); } - size_t calcOffset(const util::Coordinates &coords) override; + size_t calcOffset(const util::Coordinates &coords) const override; model::Layout layout() const override; bool has_padding() const override { return false; } model::DataType data_type() const override { return _info.typeInfo().type(); } -- 2.7.4