From 35767bc09f21050a9767a91b086b327afc928a81 Mon Sep 17 00:00:00 2001 From: Pablo Tello Date: Wed, 5 Dec 2018 17:36:30 +0000 Subject: 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 Tested-by: Arm Jenkins --- arm_compute/core/Utils.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'arm_compute/core/Utils.h') 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 +inline void permute_strides(Dimensions &dimensions, const PermutationVector &perm) +{ + const auto old_dim = utility::make_array::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 -- cgit v1.2.1