diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/datasets/ShapeDatasets.h | 32 | ||||
-rw-r--r-- | tests/validation/CL/Winograd.cpp | 20 | ||||
-rw-r--r-- | tests/validation/reference/Winograd.cpp | 19 |
3 files changed, 59 insertions, 12 deletions
diff --git a/tests/datasets/ShapeDatasets.h b/tests/datasets/ShapeDatasets.h index 8255672430..76cf9a1835 100644 --- a/tests/datasets/ShapeDatasets.h +++ b/tests/datasets/ShapeDatasets.h @@ -405,6 +405,38 @@ public: } }; +/** Data set containing small 5x5 tensor shapes. */ +class Small5x5Shapes final : public ShapeDataset +{ +public: + Small5x5Shapes() + : ShapeDataset("Shape", + { + TensorShape{ 5U, 5U, 7U, 4U }, + TensorShape{ 5U, 5U, 4U, 13U }, + TensorShape{ 5U, 5U, 9U, 2U }, + TensorShape{ 5U, 5U, 3U, 5U }, + }) + { + } +}; + +/** Data set containing large 5x5 tensor shapes. */ +class Large5x5Shapes final : public ShapeDataset +{ +public: + Large5x5Shapes() + : ShapeDataset("Shape", + { + TensorShape{ 5U, 5U, 32U, 64U }, + TensorShape{ 5U, 5U, 51U, 13U }, + TensorShape{ 5U, 5U, 53U, 47U }, + TensorShape{ 5U, 5U, 128U, 384U }, + }) + { + } +}; + /** Data set containing small tensor shapes for deconvolution. */ class SmallDeconvolutionShapes final : public ShapeDataset { diff --git a/tests/validation/CL/Winograd.cpp b/tests/validation/CL/Winograd.cpp index 8fa5826470..08810eaf58 100644 --- a/tests/validation/CL/Winograd.cpp +++ b/tests/validation/CL/Winograd.cpp @@ -201,19 +201,23 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combi winograd_filter_transform.configure(&a, &b, winograd_info); } -FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradFilterTransformFixture, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small3x3Shapes(), - framework::dataset::make("OutputTile", { Size2D(2U, 2U), Size2D(4U, 4U) })), - framework::dataset::make("DataLayout", { DataLayout::NCHW })), - framework::dataset::make("DataType", { DataType::F32 }))) +FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradFilterTransformFixture, framework::DatasetMode::ALL, + combine(combine(framework::dataset::concat(framework::dataset::concat(combine(datasets::Small3x3Shapes(), framework::dataset::make("OutputTile", Size2D(2U, 2U))), combine(datasets::Small3x3Shapes(), + framework::dataset::make("OutputTile", Size2D(4U, 4U)))), + combine(datasets::Small5x5Shapes(), framework::dataset::make("OutputTile", Size2D(4U, 4U)))), + framework::dataset::make("DataLayout", { DataLayout::NCHW })), + framework::dataset::make("DataType", { DataType::F32 }))) { // Validate output validate(CLAccessor(_target), _reference, tolerance_f32); } -FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradFilterTransformFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large3x3Shapes(), - framework::dataset::make("OutputTile", { Size2D(2U, 2U), Size2D(4U, 4U) })), - framework::dataset::make("DataLayout", { DataLayout::NCHW })), - framework::dataset::make("DataType", { DataType::F32 }))) +FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradFilterTransformFixture, framework::DatasetMode::NIGHTLY, + combine(combine(framework::dataset::concat(framework::dataset::concat(combine(datasets::Large3x3Shapes(), framework::dataset::make("OutputTile", Size2D(2U, 2U))), combine(datasets::Large3x3Shapes(), + framework::dataset::make("OutputTile", Size2D(4U, 4U)))), + combine(datasets::Large5x5Shapes(), framework::dataset::make("OutputTile", Size2D(4U, 4U)))), + framework::dataset::make("DataLayout", { DataLayout::NCHW })), + framework::dataset::make("DataType", { DataType::F32 }))) { // Validate output validate(CLAccessor(_target), _reference, tolerance_f32); diff --git a/tests/validation/reference/Winograd.cpp b/tests/validation/reference/Winograd.cpp index 604e25214b..757a06d847 100644 --- a/tests/validation/reference/Winograd.cpp +++ b/tests/validation/reference/Winograd.cpp @@ -43,9 +43,6 @@ namespace template <typename T> void initialize_matrix_transform(SimpleTensor<T> &src, const Size2D &output_tile_size, const Size2D &kernel_size, WinogradTransformType winograd_transform_type) { - ARM_COMPUTE_ERROR_ON((output_tile_size != Size2D(2U, 2U)) && (output_tile_size != Size2D(4U, 4U))); - ARM_COMPUTE_ERROR_ON(kernel_size != Size2D(3U, 3U)); - // Winograd input transform matrices static const float imatrix2x2_3x3[] = { @@ -86,6 +83,19 @@ void initialize_matrix_transform(SimpleTensor<T> &src, const Size2D &output_tile 0.0f, 0.0f, 1.0f }; + static const float fmatrix4x4_5x5[] = + { + 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, + -2.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, + -2.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f, + 1.0f / 90.0f, 1.0f / 45.0f, 2.0f / 45.0f, 4.0f / 45.0f, 8.0f / 45.0f, + 1.0f / 90.0f, -1.0f / 45.0f, 2.0f / 45.0f, -4.0f / 45.0f, 8.0f / 45.0f, + 4.0f / 45.0f, 2.0f / 45.0f, 1.0f / 45.0f, 1.0f / 90.0f, 1.0f / 180.0f, + 4.0f / 45.0f, -2.0f / 45.0f, 1.0f / 45.0f, -1.0f / 90.0f, 1.0f / 180.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 1.0f + + }; + // ------------------------------------------ // Winograd output transform matrices @@ -114,11 +124,12 @@ void initialize_matrix_transform(SimpleTensor<T> &src, const Size2D &output_tile { WinogradKey(std::pair<int, int>(4, 4), std::pair<int, int>(3, 3), WinogradTransformType::INPUT), imatrix4x4_3x3 }, { WinogradKey(std::pair<int, int>(2, 2), std::pair<int, int>(3, 3), WinogradTransformType::FILTER), fmatrix2x2_3x3 }, { WinogradKey(std::pair<int, int>(4, 4), std::pair<int, int>(3, 3), WinogradTransformType::FILTER), fmatrix4x4_3x3 }, + { WinogradKey(std::pair<int, int>(4, 4), std::pair<int, int>(5, 5), WinogradTransformType::FILTER), fmatrix4x4_5x5 }, { WinogradKey(std::pair<int, int>(2, 2), std::pair<int, int>(3, 3), WinogradTransformType::OUTPUT), omatrix2x2_3x3 }, { WinogradKey(std::pair<int, int>(4, 4), std::pair<int, int>(3, 3), WinogradTransformType::OUTPUT), omatrix4x4_3x3 }, }; - // Find input matrix transform + // Find transformation matrix std::map<WinogradKey, const float *>::iterator it; it = matrix_map.find(WinogradKey(std::pair<int, int>(output_tile_size.width, output_tile_size.height), |