diff options
author | Gian Marco Iodice <gianmarco.iodice@arm.com> | 2018-06-28 16:29:29 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:54:54 +0000 |
commit | 215b4ea6c9dee480a22070d5873b0b8cb52531a0 (patch) | |
tree | 398e552c4d01c0b84d03a873098a9183ba8f82e4 /tests/validation/CL/Im2Col.cpp | |
parent | ad486e21e5870f41774f30825c270762e08ae71e (diff) | |
download | ComputeLibrary-215b4ea6c9dee480a22070d5873b0b8cb52531a0.tar.gz |
COMPMID-1277 - Optimizing CLIm2ColKernel for NHWC.
This patch includes:
- Im2Col optimizations for NHWC using a new data layout
- Refactoring of CLIm2ColKernel adding validation method and auto-init
- Removed im2col_reduced from CLIm2ColKernel and created a new kernel CLFlattenLayerKernel
Change-Id: I1620640b6796baa268324b33ae92cdd8de53e27c
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/141241
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Giorgio Arena <giorgio.arena@arm.com>
Diffstat (limited to 'tests/validation/CL/Im2Col.cpp')
-rw-r--r-- | tests/validation/CL/Im2Col.cpp | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/tests/validation/CL/Im2Col.cpp b/tests/validation/CL/Im2Col.cpp index 9422fcc49b..291befa6cb 100644 --- a/tests/validation/CL/Im2Col.cpp +++ b/tests/validation/CL/Im2Col.cpp @@ -41,8 +41,18 @@ namespace validation { namespace { -const auto conv_filter_sizes = framework::dataset::make("KernelDims", { Size2D(3U, 3U), Size2D(3U, 1U), Size2D(1U, 5U), Size2D(5U, 5U), Size2D(7U, 7U) }); -const auto padstrides = framework::dataset::make("PadStride", { PadStrideInfo(1U, 1U, 0U, 0U), PadStrideInfo(1U, 1U, 1U, 1U), PadStrideInfo(2U, 2U, 0U, 2U) }); +// *INDENT-OFF* +// clang-format off +const auto conv_filter_sizes = framework::dataset::make("KernelDims", { Size2D(3U, 3U), + Size2D(5U, 5U), + Size2D(3U, 1U), + Size2D(1U, 3U), + Size2D(5U, 3U), + Size2D(1U, 1U), + Size2D(11U, 11U)} ); +const auto padstrides = framework::dataset::make("PadStride", { PadStrideInfo(1U, 1U, 0U, 0U), + PadStrideInfo(1U, 1U, 1U, 1U), + PadStrideInfo(2U, 2U, 0U, 2U) }); const auto conv_args = combine(combine(combine(conv_filter_sizes, padstrides), framework::dataset::make("QuantizationInfo", QuantizationInfo(0.5f, 10))), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })); @@ -53,23 +63,19 @@ TEST_SUITE(Im2Col) using CLIm2Col = CLSynthetizeFunction<CLIm2ColKernel>; -// *INDENT-OFF* -// clang-format off DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( framework::dataset::make("InputInfo", { TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::U8), // Unsupported data type TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::F32), // Mismatching data type TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::QASYMM8), // Bias not supported with QASYMM8 - TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::QASYMM8), // Mismatching shapes TensorInfo(TensorShape(10U, 12U, 2U, 2U), 1, DataType::QASYMM8), }), framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16), TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16), TensorInfo(TensorShape(3U, 3U, 10U, 2U), 1, DataType::QASYMM8), - TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::QASYMM8), - TensorInfo(TensorShape(18U, 80U, 1U, 2U), 1, DataType::QASYMM8), + TensorInfo(TensorShape(18U, 80U, 2U, 1U), 1, DataType::QASYMM8), })), - framework::dataset::make("HasBias", { true, true, true, false, false })), - framework::dataset::make("Expected", { false, false, false, true, true })), + framework::dataset::make("HasBias", { true, true, true, false })), + framework::dataset::make("Expected", { false, false, false, true })), input_info, output_info, has_bias, expected) { @@ -83,16 +89,18 @@ template <typename T> using CLIm2ColFixture = Im2ColValidationFixture<CLTensor, CLAccessor, CLIm2Col, T, true>; TEST_SUITE(Float) TEST_SUITE(FP32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)), - conv_args)) +FIXTURE_DATA_TEST_CASE(RunSmall, CLIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)), + conv_args), + framework::dataset::make("ChannelsFirstOutputNHWC", true))) { // Validate output validate(CLAccessor(_target), _reference); } TEST_SUITE_END() -FIXTURE_DATA_TEST_CASE(RunLarge, CLIm2ColFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F32)), - conv_args)) +FIXTURE_DATA_TEST_CASE(RunLarge, CLIm2ColFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F32)), + conv_args), + framework::dataset::make("ChannelsFirstOutputNHWC", true))) { // Validate output validate(CLAccessor(_target), _reference); @@ -101,14 +109,16 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CLIm2ColFixture<float>, framework::DatasetMode: #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC TEST_SUITE(FP16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLIm2ColFixture<half>, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16)), - conv_args)) +FIXTURE_DATA_TEST_CASE(RunSmall, CLIm2ColFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16)), + conv_args), + framework::dataset::make("ChannelsFirstOutputNHWC", true))) { // Validate output validate(CLAccessor(_target), _reference); } -FIXTURE_DATA_TEST_CASE(RunLarge, CLIm2ColFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F16)), - conv_args)) +FIXTURE_DATA_TEST_CASE(RunLarge, CLIm2ColFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F16)), + conv_args), + framework::dataset::make("ChannelsFirstOutputNHWC", true))) { // Validate output validate(CLAccessor(_target), _reference); @@ -120,14 +130,16 @@ TEST_SUITE_END() TEST_SUITE_END() TEST_SUITE(QASYMM8) -FIXTURE_DATA_TEST_CASE(RunSmall, CLIm2ColFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::QASYMM8)), - conv_args)) +FIXTURE_DATA_TEST_CASE(RunSmall, CLIm2ColFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::QASYMM8)), + conv_args), + framework::dataset::make("ChannelsFirstOutputNHWC", true))) { // Validate output validate(CLAccessor(_target), _reference); } -FIXTURE_DATA_TEST_CASE(RunLarge, CLIm2ColFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::QASYMM8)), - conv_args)) +FIXTURE_DATA_TEST_CASE(RunLarge, CLIm2ColFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::QASYMM8)), + conv_args), + framework::dataset::make("ChannelsFirstOutputNHWC", false))) { // Validate output validate(CLAccessor(_target), _reference); |