summaryrefslogtreecommitdiff
path: root/runtimes/pure_arm_compute/src/internal/nnapi/feature/View.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtimes/pure_arm_compute/src/internal/nnapi/feature/View.h')
-rw-r--r--runtimes/pure_arm_compute/src/internal/nnapi/feature/View.h61
1 files changed, 56 insertions, 5 deletions
diff --git a/runtimes/pure_arm_compute/src/internal/nnapi/feature/View.h b/runtimes/pure_arm_compute/src/internal/nnapi/feature/View.h
index 083b6b055..965e42f1c 100644
--- a/runtimes/pure_arm_compute/src/internal/nnapi/feature/View.h
+++ b/runtimes/pure_arm_compute/src/internal/nnapi/feature/View.h
@@ -14,12 +14,17 @@
* limitations under the License.
*/
+/**
+ * @file View.h
+ * @ingroup COM_AI_RUNTIME
+ * @brief This file defines internal::nnapi::feature::View class
+ */
#ifndef __INTERNAL_NNAPI_FEATURE_VIEW_H__
#define __INTERNAL_NNAPI_FEATURE_VIEW_H__
#include "internal/nnapi/feature/Utils.h"
-#include "util/feature/Reader.h"
+#include "misc/feature/Reader.h"
namespace internal
{
@@ -28,25 +33,55 @@ namespace nnapi
namespace feature
{
-template <typename T> class View final : public nnfw::util::feature::Reader<T>
+/**
+ * @brief Class to access feature's element information using index
+ */
+template <typename T> class View final : public nnfw::misc::feature::Reader<T>
{
public:
+ /**
+ * @brief Construct a new View object
+ * @param[in] shape Shape of feature
+ * @param[in] ptr Pointer to feature data
+ * @param[in] len Size of feature (byte)
+ * @return
+ */
// NOTE The parameter len denotes the number of bytes.
- View(const ::nnfw::util::feature::Shape &shape, T *ptr, size_t len) : _shape{shape}, _ptr{ptr}
+ View(const ::nnfw::misc::feature::Shape &shape, T *ptr, size_t len) : _shape{shape}, _ptr{ptr}
{
assert(shape.N * shape.C * shape.H * shape.W * sizeof(T) == len);
}
public:
- const nnfw::util::feature::Shape &shape(void) const { return _shape; }
+ /**
+ * @brief Get shape of feature
+ * @return Shape of feature
+ */
+ const nnfw::misc::feature::Shape &shape(void) const { return _shape; }
public:
+ /**
+ * @brief Get value of element in 3D feature using channel, row, and column index
+ * @param[in] ch Channel index
+ * @param[in] row Row index
+ * @param[in] col Column index
+ * @return Value of element
+ */
T at(uint32_t ch, uint32_t row, uint32_t col) const override
{
uint32_t index = index_of(_shape, ch, row, col);
return _ptr[index];
}
+
+ /**
+ * @brief Get value of element in 4D feature using batch, channel, row and column index
+ * @param[in] batch Batch index
+ * @param[in] ch Channel index
+ * @param[in] row Row index
+ * @param[in] col Column index
+ * @return Value of element
+ */
T at(uint32_t batch, uint32_t ch, uint32_t row, uint32_t col) const override
{
uint32_t index = index_of(_shape, batch, ch, row, col);
@@ -54,12 +89,28 @@ public:
return _ptr[index];
}
+ /**
+ * @brief Get reference of element in 3D feature using channel, row, and column index
+ * @param[in] ch Channel index
+ * @param[in] row Row index
+ * @param[in] col Column index
+ * @return Reference of element
+ */
T &at(uint32_t ch, uint32_t row, uint32_t col)
{
uint32_t index = index_of(_shape, ch, row, col);
return _ptr[index];
}
+
+ /**
+ * @brief Get reference of element in 4D feature using batch, channel, row and column index
+ * @param[in] batch Batch index
+ * @param[in] ch Channel index
+ * @param[in] row Row index
+ * @param[in] col Column index
+ * @return Reference of element
+ */
T &at(uint32_t batch, uint32_t ch, uint32_t row, uint32_t col)
{
uint32_t index = index_of(_shape, batch, ch, row, col);
@@ -68,7 +119,7 @@ public:
}
private:
- nnfw::util::feature::Shape _shape;
+ nnfw::misc::feature::Shape _shape;
private:
T *_ptr;