From 4ad6598e4ab54d450162b97e9db9b5e314b7cb3d Mon Sep 17 00:00:00 2001 From: Isabella Gottardi Date: Thu, 25 Oct 2018 17:42:19 +0100 Subject: COMPMID-1451: Fix CL/NEPermuteKernel PermuteVection check COMPMID-1690: Add tests for NEPermute with PermutationVector dimension > 3 Change-Id: I4bfc6ff88cd46863c2e39975b5663c624db1a63d Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/155316 Reviewed-by: Georgios Pinitas Tested-by: bsgcomp --- src/core/NEON/kernels/NEPermuteKernel.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/core/NEON/kernels/NEPermuteKernel.cpp') diff --git a/src/core/NEON/kernels/NEPermuteKernel.cpp b/src/core/NEON/kernels/NEPermuteKernel.cpp index 8d3fd88329..29e6d501a6 100644 --- a/src/core/NEON/kernels/NEPermuteKernel.cpp +++ b/src/core/NEON/kernels/NEPermuteKernel.cpp @@ -50,7 +50,8 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, c DataType::U16, DataType::S16, DataType::U32, DataType::S32, DataType::F16, DataType::F32); - ARM_COMPUTE_RETURN_ERROR_ON_MSG((perm.num_dimensions() == 3 && !(perm[0] == 2 && perm[1] == 0 && perm[2] == 1) && !(perm[0] == 1 && perm[1] == 2 && perm[2] == 0)), + ARM_COMPUTE_RETURN_ERROR_ON_MSG((perm != PermutationVector{ 2U, 0U, 1U }) + && (perm != PermutationVector{ 1U, 2U, 0U }), "Only [2, 0, 1] and [1, 2, 0] permutation is supported"); const TensorShape output_shape = misc::shape_calculator::compute_permutation_output_shape(*input, perm); @@ -89,7 +90,7 @@ void NEPermuteKernel::run_permute(const Window &window) Iterator out(_output, window_out); // CHW -> HWC - if((_perm.num_dimensions() == 3) && (_perm[0] == 2) && (_perm[1] == 0) && (_perm[2] == 1)) + if(_perm == PermutationVector{ 2U, 0U, 1U }) { const int in_row_stride = _input->info()->strides_in_bytes().y() / sizeof(T); const int in_channel_stride = _input->info()->strides_in_bytes().z() / sizeof(T); @@ -116,7 +117,7 @@ void NEPermuteKernel::run_permute(const Window &window) in, out); } // HWC -> CHW - else if((_perm.num_dimensions() == 3) && (_perm[0] == 1) && (_perm[1] == 2) && (_perm[2] == 0)) + else if(_perm == PermutationVector{ 1U, 2U, 0U }) { const int in_col_stride = _input->info()->strides_in_bytes().y() / sizeof(T); const int in_row_stride = _input->info()->strides_in_bytes().z() / sizeof(T); -- cgit v1.2.1