aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/Helpers.h
diff options
context:
space:
mode:
authorGiorgio Arena <giorgio.arena@arm.com>2021-10-06 12:54:29 +0100
committerGiorgio Arena <giorgio.arena@arm.com>2021-10-07 11:34:26 +0000
commitc9fe9fc3fc8c58a9d724776f75831ab35f07b253 (patch)
tree3d0ca5dfa67fc62bd063925dc0bc179ad0d08c5a /arm_compute/core/Helpers.h
parentb6af482bc5d8e4f03f876e17909c561de198c4d3 (diff)
downloadComputeLibrary-c9fe9fc3fc8c58a9d724776f75831ab35f07b253.tar.gz
Add support for 5D data layout indexing
Signed-off-by: Giorgio Arena <giorgio.arena@arm.com> Change-Id: Ib346bb6b90d2220ec5934c83a9a1f0cd540b8731 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6377 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gunes Bayir <gunes.bayir@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/Helpers.h')
-rw-r--r--arm_compute/core/Helpers.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/arm_compute/core/Helpers.h b/arm_compute/core/Helpers.h
index b6635aba6d..fd6e94c079 100644
--- a/arm_compute/core/Helpers.h
+++ b/arm_compute/core/Helpers.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2020 Arm Limited.
+ * Copyright (c) 2016-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -180,6 +180,22 @@ inline Coordinates index2coords(const TensorShape &shape, int index);
*/
inline int coords2index(const TensorShape &shape, const Coordinates &coord);
+/** Returns a static map used to find an index or dimension based on a data layout
+ *
+ * *** Layouts ***
+ *
+ * *** 4D ***
+ * [N C H W]
+ * [3 2 1 0]
+ * [N H W C]
+ *
+ * * *** 5D ***
+ * [N C D H W]
+ * [4 3 2 1 0]
+ * [N D H W C]
+ */
+const std::map<DataLayout, std::vector<DataLayoutDimension>> &get_layout_map();
+
/** Get the index of the given dimension.
*
* @param[in] data_layout The data layout.
@@ -187,7 +203,7 @@ inline int coords2index(const TensorShape &shape, const Coordinates &coord);
*
* @return The int conversion of the requested data layout index.
*/
-inline size_t get_data_layout_dimension_index(const DataLayout data_layout, const DataLayoutDimension data_layout_dimension);
+inline size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension);
/** Get the DataLayoutDimension of a given index and layout.
*
@@ -196,7 +212,7 @@ inline size_t get_data_layout_dimension_index(const DataLayout data_layout, cons
*
* @return The dimension which this index is requested for.
*/
-inline DataLayoutDimension get_index_data_layout_dimension(const DataLayout data_layout, const size_t index);
+inline DataLayoutDimension get_index_data_layout_dimension(const DataLayout &data_layout, const size_t index);
/** Calculate the number of output tiles required by Winograd Convolution layer. This utility function can be used by the Winograd input transform
* to know the number of tiles on the x and y direction