From 69af6cf5ec6edce564dd5ef97baba5a1325e8763 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Wed, 14 Feb 2018 19:23:44 +0000 Subject: COMPMID-765: Sanitize permutation vector for Permute. If permutation vector is bigger than the tensorshape to permute then infer dimensions of size one for the extra dimensions. Change-Id: I5addb292f770d925f47f756902e16073039e8f71 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/120473 Tested-by: Jenkins Reviewed-by: Stefana Simion Reviewed-by: Anthony Barbier --- tests/datasets/DepthwiseConvolutionLayerDataset.h | 1 + tests/validation/CPP/Permute.cpp | 4 ++-- tests/validation/NEON/DepthwiseConvolutionLayer.cpp | 7 +++++-- tests/validation/NEON/Permute.cpp | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/datasets/DepthwiseConvolutionLayerDataset.h b/tests/datasets/DepthwiseConvolutionLayerDataset.h index f1dfb981aa..629217a8a8 100644 --- a/tests/datasets/DepthwiseConvolutionLayerDataset.h +++ b/tests/datasets/DepthwiseConvolutionLayerDataset.h @@ -154,6 +154,7 @@ class SmallDepthwiseConvolutionLayerDataset3x3 final : public DepthwiseConvoluti public: SmallDepthwiseConvolutionLayerDataset3x3() { + add_config(TensorShape(3U, 3U, 2U), TensorShape(3U, 3U, 2U), TensorShape(1U, 1U, 2U), PadStrideInfo(1, 1, 0, 0)); add_config(TensorShape(7U, 7U, 3U, 2U), TensorShape(3U, 3U, 3U), TensorShape(5U, 5U, 3U, 2U), PadStrideInfo(1, 1, 0, 0)); add_config(TensorShape(33U, 27U, 11U), TensorShape(3U, 3U, 11U), TensorShape(11U, 14U, 11U), PadStrideInfo(3, 2, 1, 1)); add_config(TensorShape(21U, 31U, 9U, 4U), TensorShape(3U, 3U, 9U), TensorShape(21U, 15U, 9U, 4U), PadStrideInfo(1, 2, 1, 0)); diff --git a/tests/validation/CPP/Permute.cpp b/tests/validation/CPP/Permute.cpp index 3341da3ac7..0a97041f81 100644 --- a/tests/validation/CPP/Permute.cpp +++ b/tests/validation/CPP/Permute.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -42,7 +42,7 @@ namespace validation { namespace { -const auto PermuteParametersSmall = combine(datasets::Small4DShapes(), +const auto PermuteParametersSmall = combine(concat(concat(datasets::Small2DShapes(), datasets::Small3DShapes()), datasets::Small4DShapes()), framework::dataset::make("PermutationVector", { PermutationVector(2U, 0U, 1U), PermutationVector(1U, 2U, 0U), PermutationVector(3U, 2U, 0U, 1U) })); const auto PermuteParametersLarge = combine(datasets::Large4DShapes(), framework::dataset::make("PermutationVector", { PermutationVector(2U, 0U, 1U), PermutationVector(1U, 2U, 0U), PermutationVector(3U, 2U, 0U, 1U) })); diff --git a/tests/validation/NEON/DepthwiseConvolutionLayer.cpp b/tests/validation/NEON/DepthwiseConvolutionLayer.cpp index 47e8896fd6..0cdd4c0296 100644 --- a/tests/validation/NEON/DepthwiseConvolutionLayer.cpp +++ b/tests/validation/NEON/DepthwiseConvolutionLayer.cpp @@ -82,8 +82,11 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::da validate(bias.info()->valid_region(), bias_valid_region); // Validate padding - const int step = 16 >> info.stride().first; - const PaddingSize padding = PaddingCalculator(output_shape.x(), step).required_padding(); + bool is_optimized_run = NEDepthwiseConvolutionLayer3x3Kernel::is_optimized_execution_possible(input_shape, info, data_type, DataLayout::NCHW); + const int step_non_opt_dwc = 16 >> info.stride().first; + const int step_bias_add = 16 / src.info()->element_size(); + const int step = is_optimized_run ? step_bias_add : std::max(step_non_opt_dwc, step_bias_add); + const PaddingSize padding = PaddingCalculator(output_shape.x(), step).required_padding(); validate(dst.info()->padding(), padding); } diff --git a/tests/validation/NEON/Permute.cpp b/tests/validation/NEON/Permute.cpp index 004aa8208d..7451d9e3f6 100644 --- a/tests/validation/NEON/Permute.cpp +++ b/tests/validation/NEON/Permute.cpp @@ -42,7 +42,7 @@ namespace validation { namespace { -const auto PermuteParametersSmall = combine(datasets::Small4DShapes(), +const auto PermuteParametersSmall = combine(concat(concat(datasets::Small2DShapes(), datasets::Small3DShapes()), datasets::Small4DShapes()), framework::dataset::make("PermutationVector", { PermutationVector(2U, 0U, 1U), PermutationVector(1U, 2U, 0U) })); const auto PermuteParametersLarge = combine(datasets::Large4DShapes(), framework::dataset::make("PermutationVector", { PermutationVector(2U, 0U, 1U), PermutationVector(1U, 2U, 0U) })); -- cgit v1.2.1