aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/Utils.h
diff options
context:
space:
mode:
authorPablo Tello <pablo.tello@arm.com>2018-12-05 17:36:30 +0000
committerGeorgios Pinitas <georgios.pinitas@arm.com>2018-12-12 18:48:48 +0000
commit35767bc09f21050a9767a91b086b327afc928a81 (patch)
tree0b4b3dad94566ae3c52f847103b2577ada5dd06d /arm_compute/core/Utils.h
parent1f8db2be160718979d38e3671a135d22e83cc5c2 (diff)
downloadComputeLibrary-35767bc09f21050a9767a91b086b327afc928a81.tar.gz
COMPMID-1697: NEPermute extended support for more cases.
Regardless the input data layout NEPermute function has been added support for the all the permutations of 4d tensors Added corresponding validation tests. Change-Id: I0f8f20c2c3716e908a18a59783be53efab80ef5b Reviewed-on: https://review.mlplatform.org/367 Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/Utils.h')
-rw-r--r--arm_compute/core/Utils.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/arm_compute/core/Utils.h b/arm_compute/core/Utils.h
index 7c5d87f475..696845d3ff 100644
--- a/arm_compute/core/Utils.h
+++ b/arm_compute/core/Utils.h
@@ -805,6 +805,23 @@ inline DataType data_type_for_convolution_matrix(const int16_t *conv, size_t siz
}
}
+/** Permutes the given dimensions according the permutation vector
+ *
+ * @param[in,out] dimensions Dimensions to be permuted.
+ * @param[in] perm Vector describing the permutation.
+ *
+ */
+template <typename T>
+inline void permute_strides(Dimensions<T> &dimensions, const PermutationVector &perm)
+{
+ const auto old_dim = utility::make_array<Dimensions<T>::num_max_dimensions>(dimensions.begin(), dimensions.end());
+ for(unsigned int i = 0; i < perm.num_dimensions(); ++i)
+ {
+ T dimension_val = old_dim[i];
+ dimensions.set(perm[i], dimension_val);
+ }
+}
+
/** Calculate padding requirements in case of SAME padding
*
* @param[in] input_shape Input shape