From 5420b28d54c5238ed4c4aa2ccf02a7c3855c6760 Mon Sep 17 00:00:00 2001 From: Gian Marco Date: Wed, 29 Nov 2017 10:41:38 +0000 Subject: COMPMID-710 - Fix CLTranspose and NETranspose when the input shape is a vector Fixed replacing AccessWindowTranspose with AccessWindowStatic due to the wrong padding calculation in the X direction within AccessWindowTranspose. AccessWindowTranspose should be fixed with COMPMID-708 Change-Id: I665e130b897a213ae2bf9da4bf092dd491fa00c6 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/111057 Tested-by: BSG Visual Compute Jenkins server to access repositories on http://mpd-gerrit.cambridge.arm.com Reviewed-by: Michel Iwaniec Reviewed-by: Georgios Pinitas --- tests/AssetsLibrary.h | 5 +++- tests/datasets/ShapeDatasets.h | 32 +++++++++++++++++----- tests/validation/CL/FixedPoint/FixedPoint_QS8.cpp | 6 ++-- tests/validation/CL/Transpose.cpp | 18 ++++++++---- tests/validation/NEON/FixedPoint/FixedPoint.cpp | 14 +++++----- .../validation/NEON/FixedPoint/FixedPointTarget.h | 2 ++ 6 files changed, 53 insertions(+), 24 deletions(-) (limited to 'tests') diff --git a/tests/AssetsLibrary.h b/tests/AssetsLibrary.h index 6eb1e3c5f4..49e3a83399 100644 --- a/tests/AssetsLibrary.h +++ b/tests/AssetsLibrary.h @@ -380,7 +380,10 @@ void AssetsLibrary::fill_borders_with_garbage(T &&tensor, D &&distribution, std: Window window; window.set(0, Window::Dimension(-padding_size.left, tensor.shape()[0] + padding_size.right, 1)); - window.set(1, Window::Dimension(-padding_size.top, tensor.shape()[1] + padding_size.bottom, 1)); + if(tensor.shape().num_dimensions() > 1) + { + window.set(1, Window::Dimension(-padding_size.top, tensor.shape()[1] + padding_size.bottom, 1)); + } std::mt19937 gen(_seed); diff --git a/tests/datasets/ShapeDatasets.h b/tests/datasets/ShapeDatasets.h index 3dc4566e18..173ee74958 100644 --- a/tests/datasets/ShapeDatasets.h +++ b/tests/datasets/ShapeDatasets.h @@ -35,19 +35,22 @@ namespace test { namespace datasets { -/** Data set containing 1D tensor shapes. */ -class Small1DShape final : public framework::dataset::SingletonDataset +/** Parent type for all for shape datasets. */ +using ShapeDataset = framework::dataset::ContainerDataset>; + +/** Data set containing small 1D tensor shapes. */ +class Small1DShapes final : public ShapeDataset { public: - Small1DShape() - : SingletonDataset("Shape", TensorShape{ 256U }) + Small1DShapes() + : ShapeDataset("Shape", + { + TensorShape{ 256U } + }) { } }; -/** Parent type for all for shape datasets. */ -using ShapeDataset = framework::dataset::ContainerDataset>; - /** Data set containing small 2D tensor shapes. */ class Small2DShapes final : public ShapeDataset { @@ -169,6 +172,21 @@ public: } }; +/** Data set containing large 1D tensor shapes. */ +class Large1DShapes final : public ShapeDataset +{ +public: + Large1DShapes() + : ShapeDataset("Shape", + { + TensorShape{ 1921U }, + TensorShape{ 1245U }, + TensorShape{ 4160U } + }) + { + } +}; + /** Data set containing large 2D tensor shapes. */ class Large2DShapes final : public ShapeDataset { diff --git a/tests/validation/CL/FixedPoint/FixedPoint_QS8.cpp b/tests/validation/CL/FixedPoint/FixedPoint_QS8.cpp index 0fb464112a..186fc4c673 100644 --- a/tests/validation/CL/FixedPoint/FixedPoint_QS8.cpp +++ b/tests/validation/CL/FixedPoint/FixedPoint_QS8.cpp @@ -56,7 +56,7 @@ template using CLFixedPointFixture = FixedPointValidationFixture; TEST_SUITE(Exp) -FIXTURE_DATA_TEST_CASE(RunSmall, CLFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShape(), framework::dataset::make("DataType", +FIXTURE_DATA_TEST_CASE(RunSmall, CLFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType", DataType::QS8)), framework::dataset::make("FixedPointOp", FixedPointOp::EXP)), framework::dataset::make("FractionalBits", 1, 6))) @@ -67,7 +67,7 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLFixedPointFixture, framework::Dataset TEST_SUITE_END() TEST_SUITE(Log) -FIXTURE_DATA_TEST_CASE(RunSmall, CLFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShape(), framework::dataset::make("DataType", +FIXTURE_DATA_TEST_CASE(RunSmall, CLFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType", DataType::QS8)), framework::dataset::make("FixedPointOp", FixedPointOp::LOG)), framework::dataset::make("FractionalBits", 3, 6))) @@ -78,7 +78,7 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLFixedPointFixture, framework::Dataset TEST_SUITE_END() TEST_SUITE(Invsqrt) -FIXTURE_DATA_TEST_CASE(RunSmall, CLFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShape(), framework::dataset::make("DataType", +FIXTURE_DATA_TEST_CASE(RunSmall, CLFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType", DataType::QS8)), framework::dataset::make("FixedPointOp", FixedPointOp::INV_SQRT)), framework::dataset::make("FractionalBits", 1, 6))) diff --git a/tests/validation/CL/Transpose.cpp b/tests/validation/CL/Transpose.cpp index bf3d29906d..b23aff4645 100644 --- a/tests/validation/CL/Transpose.cpp +++ b/tests/validation/CL/Transpose.cpp @@ -69,12 +69,14 @@ template using CLTransposeFixture = TransposeValidationFixture; TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunSmall, CLTransposeFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", DataType::U8))) +FIXTURE_DATA_TEST_CASE(RunSmall, CLTransposeFixture, framework::DatasetMode::PRECOMMIT, combine(concat(datasets::Small1DShapes(), datasets::Small2DShapes()), + framework::dataset::make("DataType", DataType::U8))) { // Validate output validate(CLAccessor(_target), _reference); } -FIXTURE_DATA_TEST_CASE(RunLarge, CLTransposeFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("DataType", DataType::U8))) +FIXTURE_DATA_TEST_CASE(RunLarge, CLTransposeFixture, framework::DatasetMode::NIGHTLY, combine(concat(datasets::Large1DShapes(), datasets::Large2DShapes()), + framework::dataset::make("DataType", DataType::U8))) { // Validate output validate(CLAccessor(_target), _reference); @@ -82,12 +84,14 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CLTransposeFixture, framework::Dataset TEST_SUITE_END() TEST_SUITE(U16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLTransposeFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", DataType::U16))) +FIXTURE_DATA_TEST_CASE(RunSmall, CLTransposeFixture, framework::DatasetMode::PRECOMMIT, combine(concat(datasets::Small1DShapes(), datasets::Small2DShapes()), + framework::dataset::make("DataType", DataType::U16))) { // Validate output validate(CLAccessor(_target), _reference); } -FIXTURE_DATA_TEST_CASE(RunLarge, CLTransposeFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("DataType", DataType::U16))) +FIXTURE_DATA_TEST_CASE(RunLarge, CLTransposeFixture, framework::DatasetMode::NIGHTLY, combine(concat(datasets::Large1DShapes(), datasets::Large2DShapes()), + framework::dataset::make("DataType", DataType::U16))) { // Validate output validate(CLAccessor(_target), _reference); @@ -95,12 +99,14 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CLTransposeFixture, framework::Datase TEST_SUITE_END() TEST_SUITE(U32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLTransposeFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", DataType::U32))) +FIXTURE_DATA_TEST_CASE(RunSmall, CLTransposeFixture, framework::DatasetMode::PRECOMMIT, combine(concat(datasets::Small1DShapes(), datasets::Small2DShapes()), + framework::dataset::make("DataType", DataType::U32))) { // Validate output validate(CLAccessor(_target), _reference); } -FIXTURE_DATA_TEST_CASE(RunLarge, CLTransposeFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("DataType", DataType::U32))) +FIXTURE_DATA_TEST_CASE(RunLarge, CLTransposeFixture, framework::DatasetMode::NIGHTLY, combine(concat(datasets::Large1DShapes(), datasets::Large2DShapes()), + framework::dataset::make("DataType", DataType::U32))) { // Validate output validate(CLAccessor(_target), _reference); diff --git a/tests/validation/NEON/FixedPoint/FixedPoint.cpp b/tests/validation/NEON/FixedPoint/FixedPoint.cpp index 3b25b0524b..871143bc19 100644 --- a/tests/validation/NEON/FixedPoint/FixedPoint.cpp +++ b/tests/validation/NEON/FixedPoint/FixedPoint.cpp @@ -61,7 +61,7 @@ using NEFixedPointFixture = FixedPointValidationFixture; TEST_SUITE(QS8) TEST_SUITE(Exp) -FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShape(), framework::dataset::make("DataType", +FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType", DataType::QS8)), framework::dataset::make("FixedPointOp", FixedPointOp::EXP)), framework::dataset::make("FractionalBits", 1, 7))) @@ -72,7 +72,7 @@ FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::Dataset TEST_SUITE_END() TEST_SUITE(Invsqrt) -FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShape(), framework::dataset::make("DataType", +FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType", DataType::QS8)), framework::dataset::make("FixedPointOp", FixedPointOp::INV_SQRT)), framework::dataset::make("FractionalBits", 1, 6))) @@ -83,7 +83,7 @@ FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::Dataset TEST_SUITE_END() TEST_SUITE(Log) -FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShape(), framework::dataset::make("DataType", +FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType", DataType::QS8)), framework::dataset::make("FixedPointOp", FixedPointOp::LOG)), framework::dataset::make("FractionalBits", 3, 6))) @@ -94,7 +94,7 @@ FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::Dataset TEST_SUITE_END() TEST_SUITE(Reciprocal) -FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShape(), framework::dataset::make("DataType", +FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType", DataType::QS8)), framework::dataset::make("FixedPointOp", FixedPointOp::RECIPROCAL)), framework::dataset::make("FractionalBits", 1, 6))) @@ -107,7 +107,7 @@ TEST_SUITE_END() TEST_SUITE(QS16) TEST_SUITE(Exp) -FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShape(), framework::dataset::make("DataType", +FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType", DataType::QS16)), framework::dataset::make("FixedPointOp", FixedPointOp::EXP)), framework::dataset::make("FractionalBits", 1, 15))) @@ -130,7 +130,7 @@ FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::Datase TEST_SUITE_END() TEST_SUITE(Log) -FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShape(), framework::dataset::make("DataType", +FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType", DataType::QS16)), framework::dataset::make("FixedPointOp", FixedPointOp::LOG)), framework::dataset::make("FractionalBits", 4, 14))) @@ -141,7 +141,7 @@ FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::Datase TEST_SUITE_END() TEST_SUITE(Reciprocal) -FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShape(), framework::dataset::make("DataType", +FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType", DataType::QS16)), framework::dataset::make("FixedPointOp", FixedPointOp::RECIPROCAL)), framework::dataset::make("FractionalBits", 1, 14))) diff --git a/tests/validation/NEON/FixedPoint/FixedPointTarget.h b/tests/validation/NEON/FixedPoint/FixedPointTarget.h index fa1d97f152..31ccc0817e 100644 --- a/tests/validation/NEON/FixedPoint/FixedPointTarget.h +++ b/tests/validation/NEON/FixedPoint/FixedPointTarget.h @@ -50,6 +50,7 @@ void compute_target_impl(const TensorShape &shape, DataType dt, FixedPointOp op, window = calculate_max_window(*src.info(), Steps(num_elems_processed_per_iteration)); AccessWindowHorizontal input_access(src.info(), 0, num_elems_processed_per_iteration); AccessWindowHorizontal output_access(dst.info(), 0, num_elems_processed_per_iteration); + update_window_and_padding(window, input_access, output_access); break; } case DataType::QS16: @@ -58,6 +59,7 @@ void compute_target_impl(const TensorShape &shape, DataType dt, FixedPointOp op, window = calculate_max_window(*src.info(), Steps(num_elems_processed_per_iteration)); AccessWindowHorizontal input_access(src.info(), 0, num_elems_processed_per_iteration); AccessWindowHorizontal output_access(dst.info(), 0, num_elems_processed_per_iteration); + update_window_and_padding(window, input_access, output_access); break; } default: -- cgit v1.2.1