diff options
Diffstat (limited to 'runtimes/pure_arm_compute/src/internal/nnapi/tensor/ConstView.h')
-rw-r--r-- | runtimes/pure_arm_compute/src/internal/nnapi/tensor/ConstView.h | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/runtimes/pure_arm_compute/src/internal/nnapi/tensor/ConstView.h b/runtimes/pure_arm_compute/src/internal/nnapi/tensor/ConstView.h index 38d1b291b..6a3fff646 100644 --- a/runtimes/pure_arm_compute/src/internal/nnapi/tensor/ConstView.h +++ b/runtimes/pure_arm_compute/src/internal/nnapi/tensor/ConstView.h @@ -14,6 +14,12 @@ * limitations under the License. */ +/** + * @file ConstView.h + * @brief This file contains ConstView class + * @ingroup COM_AI_RUNTIME + */ + #ifndef __INTERNAL_NNAPI_TENSOR_CONST_VIEW_H__ #define __INTERNAL_NNAPI_TENSOR_CONST_VIEW_H__ @@ -27,21 +33,36 @@ namespace nnapi namespace tensor { +/** + * @brief Wrapper class to read tensor values + * @tparam T The tensor element type + */ template <typename T> class ConstView { public: - ConstView(const ::nnfw::util::tensor::Shape &shape, const uint8_t *ptr, size_t len) + /** + * @brief Construct a ConstView class + * @param[in] shape Tensor shape + * @param[in] ptr The base pointer of actual data + * @param[in] len The number of bytes + */ + ConstView(const ::nnfw::misc::tensor::Shape &shape, const uint8_t *ptr, size_t len) : _shape{shape}, _ptr{ptr}, _len{len} { // DO NOTHING } public: - const nnfw::util::tensor::Shape &shape(void) const { return _shape; } + const nnfw::misc::tensor::Shape &shape(void) const { return _shape; } private: // TODO Make this as a helper function, and share it for both View<T> and ConstView<T> - uint32_t offset_of(const nnfw::util::tensor::Index &index) const + /** + * @brief Calculate offset for the given tensor index + * @param[in] index Tensor index + * @return The calculated offset + */ + uint32_t offset_of(const nnfw::misc::tensor::Index &index) const { if (_shape.rank() == 0) { @@ -61,7 +82,12 @@ private: } public: - T at(const nnfw::util::tensor::Index &index) const + /** + * @brief Get the value on the given index + * @param[in] index Flattened tensor index + * @return The value on the given index + */ + T at(const nnfw::misc::tensor::Index &index) const { const auto offset = offset_of(index); @@ -71,7 +97,7 @@ public: } private: - const nnfw::util::tensor::Shape _shape; + const nnfw::misc::tensor::Shape _shape; private: const uint8_t *const _ptr; |