diff options
author | Gunes Bayir <gunes.bayir@arm.com> | 2021-09-13 13:38:29 +0100 |
---|---|---|
committer | Gunes Bayir <gunes.bayir@arm.com> | 2021-09-15 19:13:17 +0000 |
commit | cc171f9e4520e16b5e1b9c483562ed022d9151fa (patch) | |
tree | f364fb4dd1d8f775c21066ae53f61185257766cc /tests/validation/CL/PadLayer.cpp | |
parent | 9d6ddfc8a0ea579fb2a46fab971f6827d93fc96b (diff) | |
download | ComputeLibrary-cc171f9e4520e16b5e1b9c483562ed022d9151fa.tar.gz |
Provide tests for fusing pad layer in graph API
There are two tests:
- A unit test that checks if certain padding configurations are to be
fused or not
- A fixture test that compares a reference implementation of pad+conv
vs target implementation using the same fusing logic as graph API
Tests are written for CL backend only to prevent code duplication.
The code written in the graph API remains untested.
Resolves: COMPMID-4702
Change-Id: Ie84d1cb910013033b46ac9d66cf5fc556d4963d2
Signed-off-by: Gunes Bayir <gunes.bayir@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6252
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Sheri Zhang <sheri.zhang@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/CL/PadLayer.cpp')
-rw-r--r-- | tests/validation/CL/PadLayer.cpp | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/tests/validation/CL/PadLayer.cpp b/tests/validation/CL/PadLayer.cpp index 370195b078..ea0cb32785 100644 --- a/tests/validation/CL/PadLayer.cpp +++ b/tests/validation/CL/PadLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,8 +21,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#include "arm_compute/graph/Utils.h" #include "arm_compute/runtime/CL/CLScheduler.h" #include "arm_compute/runtime/CL/functions/CLPadLayer.h" +#include "src/graph/mutators/MutatorUtils.h" #include "tests/CL/CLAccessor.h" #include "tests/Globals.h" #include "tests/datasets/ShapeDatasets.h" @@ -110,6 +112,63 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip( ARM_COMPUTE_EXPECT(bool(CLPadLayer::validate(&input_info.clone()->set_is_resizable(true), &output_info.clone()->set_is_resizable(true), padding, PixelValue(), mode)) == expected, framework::LogLevel::ERRORS); } +DATA_TEST_CASE(CheckFusingWithConvolution, framework::DatasetMode::ALL, zip(zip( + framework::dataset::make("DataLayout", { DataLayout::NCHW, + DataLayout::NCHW, + DataLayout::NCHW, + DataLayout::NCHW, + DataLayout::NCHW, + DataLayout::NCHW, + DataLayout::NCHW, + DataLayout::NCHW, + DataLayout::NHWC, + DataLayout::NHWC, + DataLayout::NHWC, + DataLayout::NHWC, + DataLayout::NHWC, + DataLayout::NHWC, + DataLayout::NHWC, + DataLayout::UNKNOWN + }), + framework::dataset::make("PaddingList", { PaddingList({{0, 0}, {1, 1}, {1, 1}}), // nchw + PaddingList({{1, 1}, {1, 1}, {0, 0}, {0, 0}}), + PaddingList({{1, 1}, {1, 1}}), + PaddingList({}), + PaddingList({{0, 0}}), + PaddingList({{0, 0}, {0, 0}, {0, 0}, {0, 0}}), + PaddingList({{0, 0}, {0, 0}, {0, 0}, {1, 0}}), + PaddingList({{0, 1}}), + PaddingList({{0, 0}, {1, 1}, {1, 1}}), // nhwc + PaddingList({{0, 0}, {0, 0}, {1, 1}, {1, 1}}), + PaddingList({{0, 0}, {1, 0}, {1, 1}, {0, 0}}), + PaddingList({}), + PaddingList({{0, 0}}), + PaddingList({{0, 1}}), + PaddingList({{0, 0}, {1, 1}}), + PaddingList({{0, 0}}) + })), // unknown + framework::dataset::make("Expected", { false, // nchw + true, + true, + true, + true, + true, + false, + true, + true, // nhwc + false, + true, + true, + true, + false, + true, + false // unknown + })), + data_layout, padding_list, expected) +{ + ARM_COMPUTE_EXPECT(expected == arm_compute::graph::is_padding_in_height_or_width(data_layout, padding_list), framework::LogLevel::ERRORS); +} + // clang-format on // *INDENT-ON* |