From 473cb01e84cef6cab057e9492bfa3b68f708e5d7 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Tue, 23 Feb 2021 11:48:12 +0000 Subject: Remove Compute Vision CL support Resolves COMPMID-4151 Change-Id: I46f541efe8c4087f27794d2e158b6c1547d459ba Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5160 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio --- tests/validation/CL/AbsoluteDifference.cpp | 91 ------- tests/validation/CL/Accumulate.cpp | 116 -------- tests/validation/CL/Box3x3.cpp | 75 ------ tests/validation/CL/CannyEdge.cpp | 78 ------ tests/validation/CL/ChannelCombine.cpp | 113 -------- tests/validation/CL/ChannelExtract.cpp | 106 -------- tests/validation/CL/ColorConvert.cpp | 241 ----------------- tests/validation/CL/Convolution.cpp | 285 -------------------- tests/validation/CL/Derivative.cpp | 75 ------ tests/validation/CL/Dilate.cpp | 75 ------ tests/validation/CL/EqualizeHistogram.cpp | 63 ----- tests/validation/CL/Erode.cpp | 75 ------ tests/validation/CL/FastCorners.cpp | 78 ------ tests/validation/CL/Gaussian3x3.cpp | 75 ------ tests/validation/CL/Gaussian5x5.cpp | 75 ------ tests/validation/CL/GaussianPyramid.cpp | 89 ------- tests/validation/CL/HOGDescriptor.cpp | 83 ------ tests/validation/CL/HOGDetector.cpp | 98 ------- tests/validation/CL/HOGMultiDetection.cpp | 97 ------- tests/validation/CL/HarrisCorners.cpp | 79 ------ tests/validation/CL/Histogram.cpp | 68 ----- tests/validation/CL/IntegralImage.cpp | 60 ----- tests/validation/CL/LaplacianPyramid.cpp | 114 -------- tests/validation/CL/LaplacianReconstruct.cpp | 100 ------- tests/validation/CL/Magnitude.cpp | 91 ------- tests/validation/CL/MeanStdDev.cpp | 127 --------- tests/validation/CL/Median3x3.cpp | 74 ------ tests/validation/CL/MinMaxLocation.cpp | 94 ------- tests/validation/CL/NonLinearFilter.cpp | 73 ----- tests/validation/CL/OpticalFlow.cpp | 93 ------- tests/validation/CL/Phase.cpp | 87 ------ tests/validation/CL/Scharr.cpp | 76 ------ tests/validation/CL/Sobel.cpp | 259 ------------------ tests/validation/CL/TableLookup.cpp | 82 ------ tests/validation/CL/Threshold.cpp | 65 ----- tests/validation/CL/WarpAffine.cpp | 79 ------ tests/validation/CL/WarpPerspective.cpp | 75 ------ tests/validation/NEON/Convolution.cpp | 295 --------------------- tests/validation/NEON/Remap.cpp | 77 ++++++ .../fixtures/AbsoluteDifferenceFixture.h | 114 -------- tests/validation/fixtures/AccumulateFixture.h | 193 -------------- tests/validation/fixtures/Box3x3Fixture.h | 117 -------- tests/validation/fixtures/CannyEdgeFixture.h | 121 --------- tests/validation/fixtures/ChannelCombineFixture.h | 266 ------------------- tests/validation/fixtures/ChannelExtractFixture.h | 192 -------------- tests/validation/fixtures/ColorConvertFixture.h | 218 --------------- tests/validation/fixtures/ConvolutionFixture.h | 235 ---------------- tests/validation/fixtures/DerivativeFixture.h | 142 ---------- tests/validation/fixtures/DilateFixture.h | 117 -------- .../validation/fixtures/EqualizeHistogramFixture.h | 106 -------- tests/validation/fixtures/ErodeFixture.h | 117 -------- tests/validation/fixtures/FastCornersFixture.h | 138 ---------- tests/validation/fixtures/Gaussian3x3Fixture.h | 117 -------- tests/validation/fixtures/Gaussian5x5Fixture.h | 117 -------- .../fixtures/GaussianPyramidHalfFixture.h | 125 --------- tests/validation/fixtures/HOGDescriptorFixture.h | 135 ---------- tests/validation/fixtures/HOGDetectorFixture.h | 138 ---------- .../validation/fixtures/HOGMultiDetectionFixture.h | 193 -------------- tests/validation/fixtures/HarrisCornersFixture.h | 115 -------- tests/validation/fixtures/HistogramFixture.h | 129 --------- tests/validation/fixtures/IntegralImageFixture.h | 106 -------- .../validation/fixtures/LaplacianPyramidFixture.h | 154 ----------- .../fixtures/LaplacianReconstructFixture.h | 104 -------- tests/validation/fixtures/MagnitudeFixture.h | 123 --------- tests/validation/fixtures/MeanStdDevFixture.h | 115 -------- tests/validation/fixtures/Median3x3Fixture.h | 117 -------- tests/validation/fixtures/MinMaxLocationFixture.h | 122 --------- tests/validation/fixtures/NonLinearFilterFixture.h | 119 --------- tests/validation/fixtures/OpticalFlowFixture.h | 186 ------------- tests/validation/fixtures/PhaseFixture.h | 122 --------- tests/validation/fixtures/SobelFixture.h | 192 -------------- tests/validation/fixtures/TableLookupFixture.h | 122 --------- tests/validation/fixtures/ThresholdFixture.h | 107 -------- tests/validation/fixtures/WarpAffineFixture.h | 121 --------- tests/validation/fixtures/WarpPerspectiveFixture.h | 134 ---------- tests/validation/reference/Convolution.cpp | 68 ----- tests/validation/reference/Convolution.h | 45 ---- 77 files changed, 77 insertions(+), 9181 deletions(-) delete mode 100644 tests/validation/CL/AbsoluteDifference.cpp delete mode 100644 tests/validation/CL/Accumulate.cpp delete mode 100644 tests/validation/CL/Box3x3.cpp delete mode 100644 tests/validation/CL/CannyEdge.cpp delete mode 100644 tests/validation/CL/ChannelCombine.cpp delete mode 100644 tests/validation/CL/ChannelExtract.cpp delete mode 100644 tests/validation/CL/ColorConvert.cpp delete mode 100644 tests/validation/CL/Convolution.cpp delete mode 100644 tests/validation/CL/Derivative.cpp delete mode 100644 tests/validation/CL/Dilate.cpp delete mode 100644 tests/validation/CL/EqualizeHistogram.cpp delete mode 100644 tests/validation/CL/Erode.cpp delete mode 100644 tests/validation/CL/FastCorners.cpp delete mode 100644 tests/validation/CL/Gaussian3x3.cpp delete mode 100644 tests/validation/CL/Gaussian5x5.cpp delete mode 100644 tests/validation/CL/GaussianPyramid.cpp delete mode 100644 tests/validation/CL/HOGDescriptor.cpp delete mode 100644 tests/validation/CL/HOGDetector.cpp delete mode 100644 tests/validation/CL/HOGMultiDetection.cpp delete mode 100644 tests/validation/CL/HarrisCorners.cpp delete mode 100644 tests/validation/CL/Histogram.cpp delete mode 100644 tests/validation/CL/IntegralImage.cpp delete mode 100644 tests/validation/CL/LaplacianPyramid.cpp delete mode 100644 tests/validation/CL/LaplacianReconstruct.cpp delete mode 100644 tests/validation/CL/Magnitude.cpp delete mode 100644 tests/validation/CL/MeanStdDev.cpp delete mode 100644 tests/validation/CL/Median3x3.cpp delete mode 100644 tests/validation/CL/MinMaxLocation.cpp delete mode 100644 tests/validation/CL/NonLinearFilter.cpp delete mode 100644 tests/validation/CL/OpticalFlow.cpp delete mode 100644 tests/validation/CL/Phase.cpp delete mode 100644 tests/validation/CL/Scharr.cpp delete mode 100644 tests/validation/CL/Sobel.cpp delete mode 100644 tests/validation/CL/TableLookup.cpp delete mode 100644 tests/validation/CL/Threshold.cpp delete mode 100644 tests/validation/CL/WarpAffine.cpp delete mode 100644 tests/validation/CL/WarpPerspective.cpp delete mode 100644 tests/validation/NEON/Convolution.cpp create mode 100644 tests/validation/NEON/Remap.cpp delete mode 100644 tests/validation/fixtures/AbsoluteDifferenceFixture.h delete mode 100644 tests/validation/fixtures/AccumulateFixture.h delete mode 100644 tests/validation/fixtures/Box3x3Fixture.h delete mode 100644 tests/validation/fixtures/CannyEdgeFixture.h delete mode 100644 tests/validation/fixtures/ChannelCombineFixture.h delete mode 100644 tests/validation/fixtures/ChannelExtractFixture.h delete mode 100644 tests/validation/fixtures/ColorConvertFixture.h delete mode 100644 tests/validation/fixtures/ConvolutionFixture.h delete mode 100644 tests/validation/fixtures/DerivativeFixture.h delete mode 100644 tests/validation/fixtures/DilateFixture.h delete mode 100644 tests/validation/fixtures/EqualizeHistogramFixture.h delete mode 100644 tests/validation/fixtures/ErodeFixture.h delete mode 100644 tests/validation/fixtures/FastCornersFixture.h delete mode 100644 tests/validation/fixtures/Gaussian3x3Fixture.h delete mode 100644 tests/validation/fixtures/Gaussian5x5Fixture.h delete mode 100644 tests/validation/fixtures/GaussianPyramidHalfFixture.h delete mode 100644 tests/validation/fixtures/HOGDescriptorFixture.h delete mode 100644 tests/validation/fixtures/HOGDetectorFixture.h delete mode 100644 tests/validation/fixtures/HOGMultiDetectionFixture.h delete mode 100644 tests/validation/fixtures/HarrisCornersFixture.h delete mode 100644 tests/validation/fixtures/HistogramFixture.h delete mode 100644 tests/validation/fixtures/IntegralImageFixture.h delete mode 100644 tests/validation/fixtures/LaplacianPyramidFixture.h delete mode 100644 tests/validation/fixtures/LaplacianReconstructFixture.h delete mode 100644 tests/validation/fixtures/MagnitudeFixture.h delete mode 100644 tests/validation/fixtures/MeanStdDevFixture.h delete mode 100644 tests/validation/fixtures/Median3x3Fixture.h delete mode 100644 tests/validation/fixtures/MinMaxLocationFixture.h delete mode 100644 tests/validation/fixtures/NonLinearFilterFixture.h delete mode 100644 tests/validation/fixtures/OpticalFlowFixture.h delete mode 100644 tests/validation/fixtures/PhaseFixture.h delete mode 100644 tests/validation/fixtures/SobelFixture.h delete mode 100644 tests/validation/fixtures/TableLookupFixture.h delete mode 100644 tests/validation/fixtures/ThresholdFixture.h delete mode 100644 tests/validation/fixtures/WarpAffineFixture.h delete mode 100644 tests/validation/fixtures/WarpPerspectiveFixture.h delete mode 100644 tests/validation/reference/Convolution.cpp delete mode 100644 tests/validation/reference/Convolution.h (limited to 'tests/validation') diff --git a/tests/validation/CL/AbsoluteDifference.cpp b/tests/validation/CL/AbsoluteDifference.cpp deleted file mode 100644 index f3eb129118..0000000000 --- a/tests/validation/CL/AbsoluteDifference.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLAbsoluteDifference.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/ConvertPolicyDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/AbsoluteDifferenceFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/** Input data sets **/ -const auto AbsoluteDifferenceU8Dataset = combine(combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::U8)), framework::dataset::make("DataType", - DataType::U8)); -const auto AbsoluteDifferenceS16Dataset = combine(combine(framework::dataset::make("DataType", { DataType::U8, DataType::S16 }), framework::dataset::make("DataType", DataType::S16)), - framework::dataset::make("DataType", DataType::S16)); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(AbsoluteDifference) - -template -using CLAbsoluteDifferenceFixture = AbsoluteDifferenceValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunSmall, CLAbsoluteDifferenceFixture, framework::DatasetMode::NIGHTLY, combine(datasets::SmallShapes(), AbsoluteDifferenceU8Dataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLAbsoluteDifferenceFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), AbsoluteDifferenceU8Dataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLAbsoluteDifferenceFixture, framework::DatasetMode::NIGHTLY, combine(datasets::SmallShapes(), AbsoluteDifferenceS16Dataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLAbsoluteDifferenceFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), AbsoluteDifferenceS16Dataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -TEST_SUITE_END() // S16 - -TEST_SUITE_END() // AbsoluteDifference -TEST_SUITE_END() // CL - -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Accumulate.cpp b/tests/validation/CL/Accumulate.cpp deleted file mode 100644 index 8f5c6d5deb..0000000000 --- a/tests/validation/CL/Accumulate.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLAccumulate.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/ConvertPolicyDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/AccumulateFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/** Tolerance value for comparing reference's output against implementation's output for floating point data types */ -constexpr AbsoluteTolerance tolerance(1.0f); -/** Input data sets **/ -const auto AccumulateU8Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::U8)); -const auto AccumulateS16Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S16)); -} // namespace -TEST_SUITE(CL) -TEST_SUITE(Accumulate) - -TEST_SUITE(U8) -template -using CLAccumulateFixture = AccumulateValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLAccumulateFixture, framework::DatasetMode::NIGHTLY, combine(datasets::SmallShapes(), AccumulateS16Dataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLAccumulateFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), AccumulateS16Dataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance); -} - -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE(AccumulateWeighted) - -TEST_SUITE(U8) -template -using CLAccumulateWeightedFixture = AccumulateWeightedValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLAccumulateWeightedFixture, framework::DatasetMode::NIGHTLY, combine(datasets::SmallShapes(), AccumulateU8Dataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLAccumulateWeightedFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), AccumulateU8Dataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance); -} - -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE(AccumulateSquared) - -TEST_SUITE(U8) -template -using CLAccumulateSquaredFixture = AccumulateSquaredValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLAccumulateSquaredFixture, framework::DatasetMode::NIGHTLY, combine(datasets::SmallShapes(), AccumulateS16Dataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLAccumulateSquaredFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), AccumulateS16Dataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance); -} - -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Box3x3.cpp b/tests/validation/CL/Box3x3.cpp deleted file mode 100644 index 6fd531b798..0000000000 --- a/tests/validation/CL/Box3x3.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLBox3x3.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/Box3x3Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr unsigned int filter_size = 3; /* Size of the kernel/filter in number of elements. */ -constexpr BorderSize border_size(filter_size / 2); /* Border size of the kernel/filter around its central element. */ -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(Box3x3) - -template -using CLBox3x3Fixture = Box3x3ValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLBox3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), border_size)); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLBox3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), border_size)); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/CannyEdge.cpp b/tests/validation/CL/CannyEdge.cpp deleted file mode 100644 index c127eaca84..0000000000 --- a/tests/validation/CL/CannyEdge.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLCannyEdge.h" -#include "tests/CL/CLAccessor.h" -#include "tests/CL/CLArrayAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ImageFileDatasets.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/CannyEdgeFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/* Allowed ratio of mismatches between target and reference (1.0 = 100%) */ -const float allowed_mismatch_ratio = 0.1f; - -const auto data = combine(framework::dataset::make("GradientSize", -{ 3, 5, 7 }), -combine(framework::dataset::make("Normalization", { MagnitudeType::L1NORM, MagnitudeType::L2NORM }), datasets::BorderModes())); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(CannyEdge) - -template -using CLCannyEdgeFixture = CannyEdgeValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLCannyEdgeFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallImageFiles(), data), framework::dataset::make("Format", Format::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference, AbsoluteTolerance(0), allowed_mismatch_ratio); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLCannyEdgeFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeImageFiles(), data), framework::dataset::make("Format", Format::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference, AbsoluteTolerance(0), allowed_mismatch_ratio); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/ChannelCombine.cpp b/tests/validation/CL/ChannelCombine.cpp deleted file mode 100644 index 2ed0765eb9..0000000000 --- a/tests/validation/CL/ChannelCombine.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLMultiImage.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLChannelCombine.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/ConvertPolicyDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/ChannelCombineFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(ChannelCombine) - -template -using CLChannelCombineFixture = ChannelCombineValidationFixture; - -TEST_SUITE(RGBA) -FIXTURE_DATA_TEST_CASE(RunSmall, CLChannelCombineFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), framework::dataset::make("FormatType", { Format::RGB888, Format::RGBA8888 }))) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLChannelCombineFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("FormatType", { Format::RGB888, Format::RGBA8888 }))) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -TEST_SUITE_END() // RGBA - -TEST_SUITE(YUV) -FIXTURE_DATA_TEST_CASE(RunSmall, CLChannelCombineFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), framework::dataset::make("FormatType", { Format::YUYV422, Format::UYVY422 }))) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLChannelCombineFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("FormatType", { Format::YUYV422, Format::UYVY422 }))) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -TEST_SUITE_END() // YUV - -TEST_SUITE(YUVPlanar) -FIXTURE_DATA_TEST_CASE(RunSmall, CLChannelCombineFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), framework::dataset::make("FormatType", { Format::NV12, Format::NV21, Format::IYUV, Format::YUV444 }))) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLChannelCombineFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("FormatType", { Format::NV12, Format::NV21, Format::IYUV, Format::YUV444 }))) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -TEST_SUITE_END() // YUVPlanar - -TEST_SUITE_END() // ChannelCombine -TEST_SUITE_END() // CL - -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/ChannelExtract.cpp b/tests/validation/CL/ChannelExtract.cpp deleted file mode 100644 index b02741f1de..0000000000 --- a/tests/validation/CL/ChannelExtract.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLMultiImage.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLChannelExtract.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/ConvertPolicyDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/ChannelExtractFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -// Input data sets -const auto ChannelExtractRGBADataset = combine(framework::dataset::make("FormatType", { Format::RGBA8888 }), - framework::dataset::make("ChannelType", { Channel::R, Channel::G, Channel::B, Channel::A })); -const auto ChannelExtractYUVDataset = combine(framework::dataset::make("FormatType", { Format::YUYV422, Format::UYVY422 }), - framework::dataset::make("ChannelType", { Channel::Y, Channel::U, Channel::V })); -const auto ChannelExtractYUVPlanarDataset = combine(framework::dataset::make("FormatType", { Format::IYUV, Format::YUV444, Format::NV12, Format::NV21 }), - framework::dataset::make("ChannelType", { Channel::Y, Channel::U, Channel::V })); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(ChannelExtract) - -template -using CLChannelExtractFixture = ChannelExtractValidationFixture; - -TEST_SUITE(RGBA) -FIXTURE_DATA_TEST_CASE(RunSmall, CLChannelExtractFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), ChannelExtractRGBADataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLChannelExtractFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ChannelExtractRGBADataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -TEST_SUITE_END() // RGBA - -TEST_SUITE(YUV) -FIXTURE_DATA_TEST_CASE(RunSmall, CLChannelExtractFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), ChannelExtractYUVDataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLChannelExtractFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ChannelExtractYUVDataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -TEST_SUITE_END() // YUV - -TEST_SUITE(YUVPlanar) -FIXTURE_DATA_TEST_CASE(RunSmall, CLChannelExtractFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), ChannelExtractYUVPlanarDataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLChannelExtractFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ChannelExtractYUVPlanarDataset)) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -TEST_SUITE_END() // YUVPlanar - -TEST_SUITE_END() // ChannelExtract -TEST_SUITE_END() // CL - -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/ColorConvert.cpp b/tests/validation/CL/ColorConvert.cpp deleted file mode 100644 index 0d672a09ff..0000000000 --- a/tests/validation/CL/ColorConvert.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/CL/CLMultiImage.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLColorConvert.h" -#include "tests/CL/CLAccessor.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/ColorConvertFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr AbsoluteTolerance tolerance_nv(2); -constexpr AbsoluteTolerance tolerance_u8(1); - -// Input data sets -const auto RGBDataset = framework::dataset::make("FormatType", { Format::RGB888, Format::RGBA8888 }); -const auto YUYVDataset = framework::dataset::make("FormatType", { Format::YUYV422, Format::UYVY422 }); - -const auto ColorConvert_RGBA_to_RGB = combine(framework::dataset::make("FormatType", { Format::RGBA8888 }), - framework::dataset::make("FormatType", { Format::RGB888 })); - -const auto ColorConvert_RGB_to_RGBA = combine(framework::dataset::make("FormatType", { Format::RGB888 }), - framework::dataset::make("FormatType", { Format::RGBA8888 })); - -const auto ColorConvert_RGB_to_U8 = combine(framework::dataset::make("FormatType", { Format::RGB888 }), - framework::dataset::make("FormatType", { Format::U8 })); - -const auto ColorConvert_YUYV_to_RGBDataset = combine(YUYVDataset, - RGBDataset); - -const auto ColorConvert_YUVPlanar_to_RGBDataset = combine(framework::dataset::make("FormatType", { Format::IYUV, Format::NV12, Format::NV21 }), - RGBDataset); - -const auto ColorConvert_RGBDataset_to_NVDataset = combine(RGBDataset, - framework::dataset::make("FormatType", { Format::NV12, Format::IYUV, Format::YUV444 })); - -const auto ColorConvert_YUYVDataset_to_NVDataset = combine(YUYVDataset, - framework::dataset::make("FormatType", { Format::NV12, Format::IYUV })); - -const auto ColorConvert_NVDataset_to_YUVDataset = combine(framework::dataset::make("FormatType", { Format::NV12, Format::NV21 }), - framework::dataset::make("FormatType", { Format::IYUV, Format::YUV444 })); - -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(ColorConvert) - -template -using CLColorConvertFixture = ColorConvertValidationFixture; - -TEST_SUITE(RGBA) -FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), ColorConvert_RGBA_to_RGB)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBA_to_RGB)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -TEST_SUITE_END() - -TEST_SUITE(RGB) -FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), ColorConvert_RGB_to_RGBA)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGB_to_RGBA)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -TEST_SUITE_END() - -TEST_SUITE(RGBtoU8) -FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), ColorConvert_RGB_to_U8)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx], tolerance_u8); - } -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGB_to_U8)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx], tolerance_u8); - } -} -TEST_SUITE_END() - -TEST_SUITE(YUV) -FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), ColorConvert_YUYV_to_RGBDataset)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYV_to_RGBDataset)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -TEST_SUITE_END() - -TEST_SUITE(YUVPlanar) -FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -TEST_SUITE_END() - -TEST_SUITE(NV) -FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), ColorConvert_RGBDataset_to_NVDataset)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx], tolerance_nv); - } -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBDataset_to_NVDataset)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx], tolerance_nv); - } -} -TEST_SUITE_END() - -TEST_SUITE(YUYVtoNV) -FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), ColorConvert_YUYVDataset_to_NVDataset)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYVDataset_to_NVDataset)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} - -TEST_SUITE_END() - -TEST_SUITE(NVtoYUV) -FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), ColorConvert_NVDataset_to_YUVDataset)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_NVDataset_to_YUVDataset)) -{ - // Validate output - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]); - } -} - -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Convolution.cpp b/tests/validation/CL/Convolution.cpp deleted file mode 100644 index 1608e7c66d..0000000000 --- a/tests/validation/CL/Convolution.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLConvolution.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/ConvolutionFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(CustomConvolution) -TEST_SUITE(Square3x3) -template -using CLConvolutionFixture = ConvolutionSquareValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 3 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 3 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Square 3x3 - -TEST_SUITE(Square5x5) -template -using CLConvolutionFixture = ConvolutionSquareValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 5 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 5 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Square5x5 - -TEST_SUITE(Square7x7) -template -using CLConvolutionFixture = ConvolutionSquareValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 7 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 7 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Square7x7 - -TEST_SUITE(Square9x9) - -template -using CLConvolutionFixture = ConvolutionSquareValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 9 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 9 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Square9x9 - -TEST_SUITE(Rectangle) -template -using CLConvolutionFixture = ConvolutionRectangleValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_width", { 3, 5, 7, 9 })), - framework::dataset::make("filter_height", { 3, 5, 7, 9 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_width", { 3, 5, 7, 9 })), - framework::dataset::make("filter_height", { 3, 5, 7, 9 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Rectangle - -TEST_SUITE(Separable5x5) -template -using CLConvolutionFixture = ConvolutionSeparableValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 5 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 5 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Separable5x5 - -TEST_SUITE(Separable7x7) -template -using CLConvolutionFixture = ConvolutionSeparableValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 7 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 7 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Separable7x7 - -TEST_SUITE(Separable9x9) -template -using CLConvolutionFixture = ConvolutionSeparableValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 9 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 9 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2))); -} -TEST_SUITE_END() -TEST_SUITE_END() // Separable9x9 - -TEST_SUITE_END() // Custom Convolution -TEST_SUITE_END() // CL -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Derivative.cpp b/tests/validation/CL/Derivative.cpp deleted file mode 100644 index b8f6856a47..0000000000 --- a/tests/validation/CL/Derivative.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "arm_compute/runtime/CL/functions/CLDerivative.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/GradientDimensionDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/DerivativeFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(Derivative) - -using CLDerivativeFixture = DerivativeValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLDerivativeFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - datasets::GradientDimensions())) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); - - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLDerivativeFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - datasets::GradientDimensions())) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); - - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Dilate.cpp b/tests/validation/CL/Dilate.cpp deleted file mode 100644 index c5fdb3faa7..0000000000 --- a/tests/validation/CL/Dilate.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLDilate.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/DilateFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr unsigned int filter_size = 3; /* Size of the kernel/filter in number of elements. */ -constexpr BorderSize border_size(filter_size / 2); /* Border size of the kernel/filter around its central element. */ -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(Dilate) - -template -using CLDilateFixture = DilateValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLDilateFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), border_size)); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLDilateFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), border_size)); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/EqualizeHistogram.cpp b/tests/validation/CL/EqualizeHistogram.cpp deleted file mode 100644 index 3585825782..0000000000 --- a/tests/validation/CL/EqualizeHistogram.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "arm_compute/runtime/CL/functions/CLEqualizeHistogram.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Macros.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/EqualizeHistogramFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(EqualizeHistogram) - -template -using CLEqualizeHistogramFixture = EqualizeHistogramValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLEqualizeHistogramFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLEqualizeHistogramFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Erode.cpp b/tests/validation/CL/Erode.cpp deleted file mode 100644 index dd75b59a6b..0000000000 --- a/tests/validation/CL/Erode.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLErode.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/ErodeFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr unsigned int filter_size = 3; /* Size of the kernel/filter in number of elements. */ -constexpr BorderSize border_size(filter_size / 2); /* Border size of the kernel/filter around its central element. */ -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(Erode) - -template -using CLErodeFixture = ErodeValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLErodeFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), border_size)); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLErodeFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), border_size)); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/FastCorners.cpp b/tests/validation/CL/FastCorners.cpp deleted file mode 100644 index 40a511e000..0000000000 --- a/tests/validation/CL/FastCorners.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLFastCorners.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/CL/CLAccessor.h" -#include "tests/CL/CLArrayAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/ImageFileDatasets.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/FastCornersFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/* Tolerance used to compare corner strengths */ -const AbsoluteTolerance tolerance(0.5f); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(FastCorners) - -template -using CLFastCornersFixture = FastCornersValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLFastCornersFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallImageFiles(), framework::dataset::make("Format", Format::U8)), - framework::dataset::make("SuppressNonMax", { false, true })), - framework::dataset::make("BorderMode", BorderMode::UNDEFINED))) -{ - // Validate output - CLArrayAccessor array(_target); - validate_keypoints(array.buffer(), array.buffer() + array.num_values(), _reference.begin(), _reference.end(), tolerance); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLFastCornersFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeImageFiles(), framework::dataset::make("Format", Format::U8)), - framework::dataset::make("SuppressNonMax", { false, true })), - framework::dataset::make("BorderMode", BorderMode::UNDEFINED))) -{ - // Validate output - CLArrayAccessor array(_target); - validate_keypoints(array.buffer(), array.buffer() + array.num_values(), _reference.begin(), _reference.end(), tolerance); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Gaussian3x3.cpp b/tests/validation/CL/Gaussian3x3.cpp deleted file mode 100644 index b7672bdac0..0000000000 --- a/tests/validation/CL/Gaussian3x3.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLGaussian3x3.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/Gaussian3x3Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr unsigned int filter_size = 3; /* Size of the kernel/filter in number of elements. */ -constexpr BorderSize border_size(filter_size / 2); /* Border size of the kernel/filter around its central element. */ -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(Gaussian3x3) - -template -using CLGaussian3x3Fixture = Gaussian3x3ValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLGaussian3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), border_size)); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLGaussian3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), border_size)); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Gaussian5x5.cpp b/tests/validation/CL/Gaussian5x5.cpp deleted file mode 100644 index f2a1a30f33..0000000000 --- a/tests/validation/CL/Gaussian5x5.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLGaussian5x5.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/Gaussian5x5Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr unsigned int filter_size = 5; /* Size of the kernel/filter in number of elements. */ -constexpr BorderSize border_size(filter_size / 2); /* Border size of the kernel/filter around its central element. */ -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(Gaussian5x5) - -template -using CLGaussian5x5Fixture = Gaussian5x5ValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLGaussian5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), border_size)); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLGaussian5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), border_size)); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/GaussianPyramid.cpp b/tests/validation/CL/GaussianPyramid.cpp deleted file mode 100644 index d29f6752d6..0000000000 --- a/tests/validation/CL/GaussianPyramid.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2018-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLGaussianPyramid.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/GaussianPyramidHalfFixture.h" -#include "tests/validation/reference/Utils.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -const auto small_gaussian_pyramid_levels = combine(datasets::Medium2DShapes(), datasets::BorderModes()) * framework::dataset::make("numlevels", 2, 4); -const auto large_gaussian_pyramid_levels = combine(datasets::Large2DShapes(), datasets::BorderModes()) * framework::dataset::make("numlevels", 2, 5); - -template -inline void validate_gaussian_pyramid(const CLPyramid &target, const std::vector> &reference, BorderMode border_mode) -{ - ValidRegion prev_valid_region = shape_to_valid_region(reference[0].shape()); - - for(size_t i = 1; i < reference.size(); ++i) - { - const ValidRegion valid_region = shape_to_valid_region_gaussian_pyramid_half(reference[i - 1].shape(), prev_valid_region, (border_mode == BorderMode::UNDEFINED)); - - // Validate outputs - validate(CLAccessor(*(target.get_pyramid_level(i))), reference[i], valid_region); - - // Keep the valid region for the next level - prev_valid_region = valid_region; - } -} - -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(GaussianPyramid) -TEST_SUITE(Half) -template -using CLGaussianPyramidHalfFixture = GaussianPyramidHalfValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmallGaussianPyramidHalf, CLGaussianPyramidHalfFixture, framework::DatasetMode::NIGHTLY, small_gaussian_pyramid_levels) -{ - validate_gaussian_pyramid(_target, _reference, _border_mode); -} - -FIXTURE_DATA_TEST_CASE(RunLargeGaussianPyramidHalf, CLGaussianPyramidHalfFixture, framework::DatasetMode::NIGHTLY, large_gaussian_pyramid_levels) -{ - validate_gaussian_pyramid(_target, _reference, _border_mode); -} -TEST_SUITE_END() -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/HOGDescriptor.cpp b/tests/validation/CL/HOGDescriptor.cpp deleted file mode 100644 index a73e563283..0000000000 --- a/tests/validation/CL/HOGDescriptor.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/CL/CLHOG.h" -#include "arm_compute/runtime/CL/functions/CLHOGDescriptor.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/HOGDescriptorDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/HOGDescriptorFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -RelativeTolerance tolerance(0.001f); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(HOGDescriptor) - -using CLHOGDescriptorFixture = HOGDescriptorValidationFixture; - -// *INDENT-OFF* -// clang-format off -FIXTURE_DATA_TEST_CASE(RunSmall, CLHOGDescriptorFixture, framework::DatasetMode::NIGHTLY, - combine(combine( - datasets::SmallHOGDescriptorDataset(), - framework::dataset::make("Format", Format::U8)), - framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE}))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLHOGDescriptorFixture, framework::DatasetMode::NIGHTLY, - combine(combine( - datasets::LargeHOGDescriptorDataset(), - framework::dataset::make("Format", Format::U8)), - framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE}))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance); -} -// clang-format on -// *INDENT-ON* - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/HOGDetector.cpp b/tests/validation/CL/HOGDetector.cpp deleted file mode 100644 index 2d1904ffe8..0000000000 --- a/tests/validation/CL/HOGDetector.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2018-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/CL/CLArray.h" -#include "arm_compute/runtime/CL/functions/CLHOGDescriptor.h" -#include "arm_compute/runtime/CL/functions/CLHOGDetector.h" -#include "tests/CL/CLAccessor.h" -#include "tests/CL/CLArrayAccessor.h" -#include "tests/CL/CLHOGAccessor.h" -#include "tests/datasets/HOGDescriptorDataset.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/HOGDetectorFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/* Set the tolerance (percentage) used when validating the score of detection window. */ -RelativeTolerance tolerance(0.01f); - -/* Input dataset (values must be a multiple of the HOGInfo block_size) */ -const auto DetectionWindowStrideDataset = framework::dataset::make("DetectionWindowStride", { Size2D(8, 8), Size2D(16, 16) }); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(HOGDetector) - -// *INDENT-OFF* -// clang-format off -using CLHOGDetectorFixture = HOGDetectorValidationFixture, - CLHOGAccessor, - CLHOGDetector, - uint8_t, - float>; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLHOGDetectorFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine( - DetectionWindowStrideDataset, - datasets::SmallHOGDescriptorDataset()), - framework::dataset::make("Format", Format::U8)), - framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE}))) - -{ - // Validate output - validate_detection_windows(_target.begin(), _target.end(), _reference.begin(), _reference.end(), tolerance); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLHOGDetectorFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine( - DetectionWindowStrideDataset, - datasets::LargeHOGDescriptorDataset()), - framework::dataset::make("Format", Format::U8)), - framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE}))) -{ - // Validate output - validate_detection_windows(_target.begin(), _target.end(), _reference.begin(), _reference.end(), tolerance); -} - -// clang-format on -// *INDENT-ON* - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/HOGMultiDetection.cpp b/tests/validation/CL/HOGMultiDetection.cpp deleted file mode 100644 index 4ca1dab32e..0000000000 --- a/tests/validation/CL/HOGMultiDetection.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2018-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/CL/CLMultiHOG.h" -#include "arm_compute/runtime/CL/functions/CLHOGDescriptor.h" -#include "arm_compute/runtime/CL/functions/CLHOGMultiDetection.h" -#include "arm_compute/runtime/Tensor.h" -#include "tests/CL/CLAccessor.h" -#include "tests/CL/CLArrayAccessor.h" -#include "tests/CL/CLHOGAccessor.h" -#include "tests/datasets/HOGMultiDetectionDataset.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/HOGMultiDetectionFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/* Set the tolerance (percentage) used when validating the strength of detection window. */ -RelativeTolerance tolerance(0.1f); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(HOGMultiDetection) - -// *INDENT-OFF* -// clang-format off -using CLHOGMultiDetectionFixture = HOGMultiDetectionValidationFixture, - CLArrayAccessor, - CLHOGAccessor, - CLHOGMultiDetection, - uint8_t, - float>; - - -FIXTURE_DATA_TEST_CASE(RunSmall, CLHOGMultiDetectionFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine( - datasets::SmallHOGMultiDetectionDataset(), - framework::dataset::make("Format", Format::U8)), - framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})), - framework::dataset::make("NonMaximaSuppression", {false, true}))) -{ - // Validate output - validate_detection_windows(_target.begin(), _target.end(), _reference.begin(), _reference.end(), tolerance); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLHOGMultiDetectionFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine( - datasets::LargeHOGMultiDetectionDataset(), - framework::dataset::make("Format", Format::U8)), - framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})), - framework::dataset::make("NonMaximaSuppression", {false, true}))) -{ - // Validate output - validate_detection_windows(_target.begin(), _target.end(), _reference.begin(), _reference.end(), tolerance); -} - -// clang-format on -// *INDENT-ON* - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/HarrisCorners.cpp b/tests/validation/CL/HarrisCorners.cpp deleted file mode 100644 index 157102f268..0000000000 --- a/tests/validation/CL/HarrisCorners.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLArray.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLHarrisCorners.h" -#include "tests/CL/CLAccessor.h" -#include "tests/CL/CLArrayAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ImageFileDatasets.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/HarrisCornersFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -const auto data_nightly = combine(framework::dataset::make("GradientSize", { 3, 5, 7 }), combine(framework::dataset::make("BlockSize", { 3, 5, 7 }), datasets::BorderModes())); -const auto data_precommit = combine(framework::dataset::make("GradientSize", { 3 }), combine(framework::dataset::make("BlockSize", { 3 }), datasets::BorderModes())); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(HarrisCorners) - -template -using CLHarrisCornersFixture = HarrisCornersValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLHarrisCornersFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallImageFiles(), data_precommit), framework::dataset::make("Format", - Format::U8))) -{ - // Validate output - CLArrayAccessor array(_target); - validate_keypoints(array.buffer(), array.buffer() + array.num_values(), _reference.begin(), _reference.end(), RelativeTolerance(0.0001f)); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLHarrisCornersFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeImageFiles(), data_nightly), framework::dataset::make("Format", - Format::U8))) -{ - // Validate output - CLArrayAccessor array(_target); - validate_keypoints(array.buffer(), array.buffer() + array.num_values(), _reference.begin(), _reference.end(), RelativeTolerance(0.0001f)); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Histogram.cpp b/tests/validation/CL/Histogram.cpp deleted file mode 100644 index 2619a0067c..0000000000 --- a/tests/validation/CL/Histogram.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLDistribution1D.h" -#include "arm_compute/runtime/CL/functions/CLHistogram.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/HistogramFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(Histogram) - -template -using CLHistogramFixture = HistogramValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLHistogramFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLHistogramFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/IntegralImage.cpp b/tests/validation/CL/IntegralImage.cpp deleted file mode 100644 index e3b728ab9c..0000000000 --- a/tests/validation/CL/IntegralImage.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/CL/functions/CLIntegralImage.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Macros.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/IntegralImageFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(IntegralImage) -template -using CLIntegralImageFixture = IntegralImageValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLIntegralImageFixture, framework::DatasetMode::NIGHTLY, combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLIntegralImageFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/LaplacianPyramid.cpp b/tests/validation/CL/LaplacianPyramid.cpp deleted file mode 100644 index 801115ea09..0000000000 --- a/tests/validation/CL/LaplacianPyramid.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2018-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLPyramid.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLLaplacianPyramid.h" -#include "tests/CL/CLAccessor.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/LaplacianPyramidFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/* Absolute tolerance value for comparing reference's output against implementation's output for DataType::S16 - * Tolerance is needed for calculation uncertainties introduced from the layers - */ -AbsoluteTolerance tolerance_int16(1); -const auto small_laplacian_pyramid_levels = framework::dataset::make("NumLevels", 2, 3); -const auto large_laplacian_pyramid_levels = framework::dataset::make("NumLevels", 2, 5); - -const auto formats = combine(framework::dataset::make("FormatIn", Format::U8), framework::dataset::make("FormatOut", Format::S16)); - -template -inline void validate_laplacian_pyramid(const CLPyramid &target, const std::vector> &reference, BorderMode border_mode) -{ - CLTensor *level_image = target.get_pyramid_level(0); - ValidRegion valid_region = shape_to_valid_region(reference[0].shape(), border_mode == BorderMode::UNDEFINED, BorderSize(2)); - - // Validate lowest level - validate(CLAccessor(*level_image), reference[0], valid_region); - - // Validate remaining levels - for(size_t lev = 1; lev < target.info()->num_levels(); lev++) - { - level_image = target.get_pyramid_level(lev); - CLTensor *prev_level_image = target.get_pyramid_level(lev - 1); - - valid_region = shape_to_valid_region_laplacian_pyramid(prev_level_image->info()->tensor_shape(), - prev_level_image->info()->valid_region(), - border_mode == BorderMode::UNDEFINED); - - // Validate level - validate(CLAccessor(*level_image), reference[lev], valid_region, tolerance_int16); - } -} -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(LaplacianPyramid) - -// *INDENT-OFF* -// clang-format off - -using CLLaplacianPyramidFixture = LaplacianPyramidValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLLaplacianPyramidFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine( - datasets::Medium2DShapes(), - datasets::BorderModes()), - small_laplacian_pyramid_levels), - formats)) -{ - validate_laplacian_pyramid(_target, _reference, _border_mode); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLLaplacianPyramidFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine( - datasets::Large2DShapes(), - datasets::BorderModes()), - large_laplacian_pyramid_levels), - formats)) -{ - validate_laplacian_pyramid(_target, _reference, _border_mode); -} -// clang-format on -// *INDENT-ON* - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/LaplacianReconstruct.cpp b/tests/validation/CL/LaplacianReconstruct.cpp deleted file mode 100644 index e6e32ce910..0000000000 --- a/tests/validation/CL/LaplacianReconstruct.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2018-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLPyramid.h" -#include "arm_compute/runtime/CL/functions/CLLaplacianPyramid.h" -#include "arm_compute/runtime/CL/functions/CLLaplacianReconstruct.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/CL/CLAccessor.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/LaplacianReconstructFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -const auto small_laplacian_reconstruct_levels = framework::dataset::make("NumLevels", 2, 3); -const auto large_laplacian_reconstruct_levels = framework::dataset::make("NumLevels", 2, 5); - -const auto formats = combine(framework::dataset::make("FormatIn", Format::S16), framework::dataset::make("FormatOut", Format::U8)); - -template -void validate_laplacian_reconstruct(CLTensor &target, const SimpleTensor &reference, BorderMode border_mode, size_t num_levels) -{ - const unsigned int filter_size = 5; - const unsigned int border_size(filter_size / 2); - - BorderSize border(std::pow(border_size, num_levels)); - - // Validate output - ValidRegion valid_region = shape_to_valid_region(reference.shape(), border_mode == BorderMode::UNDEFINED, border); - validate(CLAccessor(target), reference, valid_region); -} -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(LaplacianReconstruct) - -// *INDENT-OFF* -// clang-format off - -using CLLaplacianReconstructFixture = LaplacianReconstructValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLLaplacianReconstructFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine( - datasets::Medium2DShapes(), - datasets::BorderModes()), - small_laplacian_reconstruct_levels), - formats)) -{ - validate_laplacian_reconstruct(_target, _reference, _border_mode, _pyramid_levels); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLLaplacianReconstructFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine( - datasets::Large2DShapes(), - datasets::BorderModes()), - large_laplacian_reconstruct_levels), - formats)) -{ - validate_laplacian_reconstruct(_target, _reference, _border_mode, _pyramid_levels); -} -// clang-format on -// *INDENT-ON* - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Magnitude.cpp b/tests/validation/CL/Magnitude.cpp deleted file mode 100644 index bf5879b527..0000000000 --- a/tests/validation/CL/Magnitude.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/CL/functions/CLMagnitude.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/MagnitudeFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -template -AbsoluteTolerance tolerance(MagnitudeType magnitude_type) -{ - return AbsoluteTolerance((MagnitudeType::L1NORM == magnitude_type) ? 0 : 1); -} -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(Magnitude) - -template -using CLMagnitudeFixture = MagnitudeValidationFixture; - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLMagnitudeFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), framework::dataset::make("Format", Format::S16)), - framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance(_magnitude_type)); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLMagnitudeFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), framework::dataset::make("Format", Format::S16)), - framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance(_magnitude_type)); -} -TEST_SUITE_END() // S16 - -TEST_SUITE(S32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLMagnitudeFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), framework::dataset::make("Format", Format::S32)), - framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance(_magnitude_type)); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLMagnitudeFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), framework::dataset::make("Format", Format::S32)), - framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance(_magnitude_type)); -} -TEST_SUITE_END() // S32 - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/MeanStdDev.cpp b/tests/validation/CL/MeanStdDev.cpp deleted file mode 100644 index 0e5135ec44..0000000000 --- a/tests/validation/CL/MeanStdDev.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/CL/functions/CLMeanStdDev.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Macros.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/MeanStdDevFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -RelativeTolerance tolerance_rel_high_error(0.05f); -RelativeTolerance tolerance_rel_low_error(0.0005f); -AbsoluteTolerance tolerance_rel_high_error_f32(0.01f); -AbsoluteTolerance tolerance_rel_low_error_f32(0.00001f); -AbsoluteTolerance tolerance_rel_high_error_f16(0.1f); -AbsoluteTolerance tolerance_rel_low_error_f16(0.01f); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(MeanStdDev) - -// *INDENT-OFF* -// clang-format off -DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip( - framework::dataset::make("InputInfo", { TensorInfo(TensorShape(16U, 16U), 1, DataType::F32), // Wrong input data type - TensorInfo(TensorShape(16U, 5U, 16U), 1, DataType::U8), // Invalid shape - TensorInfo(TensorShape(16U, 16U), 1, DataType::U8), // Valid - }), - framework::dataset::make("Expected", { false, false, true })), - input_info, expected) -{ - ARM_COMPUTE_EXPECT(bool(CLMeanStdDev::validate(&input_info.clone()->set_is_resizable(false), nullptr, nullptr)) == expected, framework::LogLevel::ERRORS); -} -// clang-format on -// *INDENT-ON* - -template -using CLMeanStdDevFixture = MeanStdDevValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunSmall, CLMeanStdDevFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate mean output - validate(_target.first, _reference.first); - - // Validate std_dev output - validate(_target.second, _reference.second, tolerance_rel_high_error); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLMeanStdDevFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate mean output - validate(_target.first, _reference.first, tolerance_rel_low_error); - - // Validate std_dev output - validate(_target.second, _reference.second, tolerance_rel_high_error); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(F16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLMeanStdDevFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", - DataType::F16))) -{ - // Validate mean output - validate(_target.first, _reference.first, tolerance_rel_low_error_f16); - - // Validate std_dev output - validate(_target.second, _reference.second, tolerance_rel_high_error_f16); -} -TEST_SUITE_END() // F16 - -TEST_SUITE(F32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLMeanStdDevFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", - DataType::F32))) -{ - // Validate mean output - validate(_target.first, _reference.first, tolerance_rel_low_error_f32); - - // Validate std_dev output - validate(_target.second, _reference.second, tolerance_rel_high_error_f32); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLMeanStdDevFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("DataType", - DataType::F32))) -{ - // Validate mean output - validate(_target.first, _reference.first, tolerance_rel_low_error_f32); - - // Validate std_dev output - validate(_target.second, _reference.second, tolerance_rel_high_error_f32); -} -TEST_SUITE_END() // F32 - -TEST_SUITE_END() // MeanStdDev -TEST_SUITE_END() // CL -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Median3x3.cpp b/tests/validation/CL/Median3x3.cpp deleted file mode 100644 index 9a09ae5be5..0000000000 --- a/tests/validation/CL/Median3x3.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLMedian3x3.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/Median3x3Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr unsigned int filter_size = 3; /* Size of the kernel/filter in number of elements. */ -constexpr BorderSize border_size(filter_size / 2); /* Border size of the kernel/filter around its central element. */ -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(Median3x3) -template -using CLMedian3x3Fixture = Median3x3ValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLMedian3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), border_size)); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLMedian3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), border_size)); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/MinMaxLocation.cpp b/tests/validation/CL/MinMaxLocation.cpp deleted file mode 100644 index 1ad863d90e..0000000000 --- a/tests/validation/CL/MinMaxLocation.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/CL/functions/CLMinMaxLocation.h" -#include "tests/CL/CLAccessor.h" -#include "tests/CL/CLArrayAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Macros.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/MinMaxLocationFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(MinMaxLocation) - -template -using CLMinMaxLocationFixture = MinMaxLocationValidationFixture, CLArrayAccessor, CLMinMaxLocation, T>; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunSmall, CLMinMaxLocationFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - validate_min_max_loc(_target, _reference); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLMinMaxLocationFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - validate_min_max_loc(_target, _reference); -} - -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLMinMaxLocationFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", - DataType::S16))) -{ - validate_min_max_loc(_target, _reference); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLMinMaxLocationFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("DataType", - DataType::S16))) -{ - validate_min_max_loc(_target, _reference); -} - -TEST_SUITE_END() // S16 - -TEST_SUITE(Float) -FIXTURE_DATA_TEST_CASE(RunSmall, CLMinMaxLocationFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", - DataType::F32))) -{ - validate_min_max_loc(_target, _reference); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLMinMaxLocationFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("DataType", - DataType::F32))) -{ - validate_min_max_loc(_target, _reference); -} - -TEST_SUITE_END() // F32 - -TEST_SUITE_END() // MinMaxLocation -TEST_SUITE_END() // CL -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/NonLinearFilter.cpp b/tests/validation/CL/NonLinearFilter.cpp deleted file mode 100644 index 3fd9d5cd73..0000000000 --- a/tests/validation/CL/NonLinearFilter.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/CL/functions/CLNonLinearFilter.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/MatrixPatternDataset.h" -#include "tests/datasets/NonLinearFilterFunctionDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Macros.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/NonLinearFilterFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(NonLinearFilter) - -template -using CLNonLinearFilterFixture = NonLinearFilterValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLNonLinearFilterFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::SmallShapes(), - datasets::NonLinearFilterFunctions()), - framework::dataset::make("MaskSize", { 3U, 5U })), - datasets::MatrixPatterns()), - datasets::BorderModes()), - framework::dataset::make("DataType", DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), _border_size)); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLNonLinearFilterFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeShapes(), - datasets::NonLinearFilterFunctions()), - framework::dataset::make("MaskSize", { 3U, 5U })), - datasets::MatrixPatterns()), - datasets::BorderModes()), - framework::dataset::make("DataType", DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), _border_size)); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/OpticalFlow.cpp b/tests/validation/CL/OpticalFlow.cpp deleted file mode 100644 index 3636a8f847..0000000000 --- a/tests/validation/CL/OpticalFlow.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2018-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/CL/CLArray.h" -#include "arm_compute/runtime/CL/CLPyramid.h" -#include "arm_compute/runtime/CL/functions/CLGaussianPyramid.h" -#include "arm_compute/runtime/CL/functions/CLOpticalFlow.h" -#include "arm_compute/runtime/Tensor.h" -#include "tests/CL/CLAccessor.h" -#include "tests/CL/CLArrayAccessor.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/OpticalFlowDataset.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/OpticalFlowFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(OpticalFlow) - -// *INDENT-OFF* -// clang-format off -using CLOpticalFlowFixture = OpticalFlowValidationFixture, - CLOpticalFlow, - CLPyramid, - CLGaussianPyramidHalf, - uint8_t>; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLOpticalFlowFixture, framework::DatasetMode::NIGHTLY, combine(combine( - datasets::SmallOpticalFlowDataset(), - framework::dataset::make("Format", Format::U8)), - datasets::BorderModes())) -{ - // Validate output - CLArrayAccessor array(_target); - - validate_keypoints(array.buffer(), - array.buffer() + array.num_values(), - _reference.begin(), - _reference.end()); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLOpticalFlowFixture, framework::DatasetMode::NIGHTLY, combine(combine( - datasets::LargeOpticalFlowDataset(), - framework::dataset::make("Format", Format::U8)), - datasets::BorderModes())) -{ - // Validate output - CLArrayAccessor array(_target); - - validate_keypoints(array.buffer(), - array.buffer() + array.num_values(), - _reference.begin(), - _reference.end()); -} -// clang-format on -// *INDENT-ON* - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Phase.cpp b/tests/validation/CL/Phase.cpp deleted file mode 100644 index be7f9df2be..0000000000 --- a/tests/validation/CL/Phase.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/CL/functions/CLPhase.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/PhaseFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr AbsoluteTolerance tolerance_value(1); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(Phase) - -template -using CLPhaseFixture = PhaseValidationFixture; - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLPhaseFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), framework::dataset::make("Format", Format::S16)), - framework::dataset::make("PhaseType", { PhaseType::SIGNED, PhaseType::UNSIGNED }))) -{ - // Validate output - validate_wrap(CLAccessor(_target), _reference, tolerance_value, 0); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLPhaseFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), framework::dataset::make("Format", Format::S16)), - framework::dataset::make("PhaseType", { PhaseType::SIGNED, PhaseType::UNSIGNED }))) -{ - // Validate output - validate_wrap(CLAccessor(_target), _reference, tolerance_value, 0); -} -TEST_SUITE_END() // S16 - -TEST_SUITE(S32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLPhaseFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), framework::dataset::make("Format", Format::S32)), - framework::dataset::make("PhaseType", { PhaseType::SIGNED, PhaseType::UNSIGNED }))) -{ - // Validate output - validate_wrap(CLAccessor(_target), _reference, tolerance_value, 0); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLPhaseFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), framework::dataset::make("Format", Format::S32)), - framework::dataset::make("PhaseType", { PhaseType::SIGNED, PhaseType::UNSIGNED }))) -{ - // Validate output - validate_wrap(CLAccessor(_target), _reference, tolerance_value, 0); -} -TEST_SUITE_END() // S32 - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Scharr.cpp b/tests/validation/CL/Scharr.cpp deleted file mode 100644 index ed1fec82fd..0000000000 --- a/tests/validation/CL/Scharr.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/CL/functions/CLScharr3x3.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/GradientDimensionDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/ScharrFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(Scharr) - -TEST_SUITE(W3x3) -using CLScharr3x3Fixture = ScharrValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLScharr3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - datasets::GradientDimensions())) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); - - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLScharr3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - datasets::GradientDimensions())) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); - - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Sobel.cpp b/tests/validation/CL/Sobel.cpp deleted file mode 100644 index 3aee0fe2e1..0000000000 --- a/tests/validation/CL/Sobel.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLSobel3x3.h" -#include "arm_compute/runtime/CL/functions/CLSobel5x5.h" -#include "arm_compute/runtime/CL/functions/CLSobel7x7.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/SobelFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(Sobel) - -TEST_SUITE(W3x3) -using CLSobel3x3Fixture = SobelValidationFixture; - -TEST_SUITE(X) -FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_X))) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_X))) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); -} -TEST_SUITE_END() - -TEST_SUITE(Y) -FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y))) -{ - // Validate output - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y))) -{ - // Validate output - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} -TEST_SUITE_END() - -TEST_SUITE(XY) -FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY))) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); - - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY))) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); - - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE(W5x5) -using CLSobel5x5Fixture = SobelValidationFixture; - -TEST_SUITE(X) -FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_X))) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_X))) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); -} -TEST_SUITE_END() -TEST_SUITE(Y) -FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y))) -{ - // Validate output - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y))) -{ - // Validate output - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} -TEST_SUITE_END() -TEST_SUITE(XY) -FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY))) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); - - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY))) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); - - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE(W7x7) -using CLSobel7x7Fixture = SobelValidationFixture; - -TEST_SUITE(X) -FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_X))) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_X))) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); -} -TEST_SUITE_END() -TEST_SUITE(Y) -FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y))) -{ - // Validate output - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y))) -{ - // Validate output - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} -TEST_SUITE_END() -TEST_SUITE(XY) -FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY))) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); - - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format", - Format::U8)), - framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY))) -{ - // Validate output - ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3)); - validate(CLAccessor(_target.first), _reference.first, valid_region_x); - - ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3)); - validate(CLAccessor(_target.second), _reference.second, valid_region_y); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/TableLookup.cpp b/tests/validation/CL/TableLookup.cpp deleted file mode 100644 index 415b91c42d..0000000000 --- a/tests/validation/CL/TableLookup.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLTableLookup.h" -#include "tests/CL/CLAccessor.h" -#include "tests/CL/CLLutAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Helpers.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/TableLookupFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(TableLookup) - -template -using CLTableLookupFixture = TableLookupValidationFixture, CLLut, T>; -TEST_SUITE(U8) - -FIXTURE_DATA_TEST_CASE(RunSmallU8, CLTableLookupFixture, framework::DatasetMode::NIGHTLY, combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLargeU8, CLTableLookupFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -TEST_SUITE_END() - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunSmallS16, CLTableLookupFixture, framework::DatasetMode::NIGHTLY, combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::S16))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLargeS16, CLTableLookupFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::S16))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/Threshold.cpp b/tests/validation/CL/Threshold.cpp deleted file mode 100644 index be26245b7e..0000000000 --- a/tests/validation/CL/Threshold.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/CL/functions/CLThreshold.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/datasets/ThresholdDataset.h" -#include "tests/framework/Macros.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/ThresholdFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(Threshold) - -template -using CLThresholdFixture = ThresholdValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLThresholdFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), datasets::MixedThresholdDataset()), - framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLThresholdFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), datasets::MixedThresholdDataset()), - framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/WarpAffine.cpp b/tests/validation/CL/WarpAffine.cpp deleted file mode 100644 index d10ba7f502..0000000000 --- a/tests/validation/CL/WarpAffine.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/core/Utils.h" -#include "arm_compute/runtime/CL/functions/CLWarpAffine.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/AssetsLibrary.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/InterpolationPolicyDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/WarpAffineFixture.h" -#include "tests/validation/reference/Utils.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/** Tolerance */ -constexpr AbsoluteTolerance tolerance(1); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(WarpAffine) - -template -using CLWarpAffineFixture = WarpAffineValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLWarpAffineFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::U8)), - framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, _valid_mask, tolerance, 0.02f); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLWarpAffineFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::U8)), - framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })), - datasets::BorderModes())) -{ - // Validate output - validate(CLAccessor(_target), _reference, _valid_mask, tolerance, 0.02f); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/CL/WarpPerspective.cpp b/tests/validation/CL/WarpPerspective.cpp deleted file mode 100644 index dd05059bed..0000000000 --- a/tests/validation/CL/WarpPerspective.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLWarpPerspective.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/WarpPerspectiveFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr AbsoluteTolerance tolerance_value(1); -constexpr float tolerance_number = 0.2f; -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(WarpPerspective) - -template -using CLWarpPerspectiveFixture = WarpPerspectiveValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLWarpPerspectiveFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::U8)), - framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })), - datasets::BorderModes())) -{ - validate(CLAccessor(_target), _reference, _valid_mask, tolerance_value, tolerance_number); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLWarpPerspectiveFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", - DataType::U8)), - framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })), - datasets::BorderModes())) -{ - validate(CLAccessor(_target), _reference, _valid_mask, tolerance_value, tolerance_number); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/NEON/Convolution.cpp b/tests/validation/NEON/Convolution.cpp deleted file mode 100644 index 2fb43273b1..0000000000 --- a/tests/validation/NEON/Convolution.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (c) 2017-2021 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/NEON/functions/NEConvolution.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "tests/NEON/Accessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets/BorderModeDataset.h" -#include "tests/datasets/ShapeDatasets.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Macros.h" -#include "tests/framework/datasets/Datasets.h" -#include "tests/validation/Validation.h" -#include "tests/validation/fixtures/ConvolutionFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/** Tolerance value for comparing reference's output against implementation - * - * This is due to the fact that Neon target performs multiplication with reciprocal of scale, - * while reference performs direct division with scale. - */ -constexpr AbsoluteTolerance tolerance_u8(1); -constexpr AbsoluteTolerance tolerance_s16(1); -} // namespace - -TEST_SUITE(NEON) -TEST_SUITE(CustomConvolution) -TEST_SUITE(Square3x3) -template -using NEConvolutionFixture = ConvolutionSquareValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 3 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 3 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Square3x3 - -TEST_SUITE(Square5x5) -template -using NEConvolutionFixture = ConvolutionSquareValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 5 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 5 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Square5x5 - -TEST_SUITE(Square7x7) -template -using NEConvolutionFixture = ConvolutionSquareValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 7 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 7 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Square7x7 - -TEST_SUITE(Square9x9) -template -using NEConvolutionFixture = ConvolutionSquareValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 9 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 9 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Square9x9 - -TEST_SUITE(Rectangle) -template -using NEConvolutionFixture = ConvolutionRectangleValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_width", { 3, 5, 7, 9 })), - framework::dataset::make("filter_height", { 3, 5, 7, 9 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_width", { 3, 5, 7, 9 })), - framework::dataset::make("filter_height", { 3, 5, 7, 9 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Rectangle - -TEST_SUITE(Separable5x5) -template -using NEConvolutionFixture = ConvolutionSeparableValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 5 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 5 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Separable5x5 - -TEST_SUITE(Separable7x7) -template -using NEConvolutionFixture = ConvolutionSeparableValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 7 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 7 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Separable7x7 - -TEST_SUITE(Separable9x9) -template -using NEConvolutionFixture = ConvolutionSeparableValidationFixture; - -TEST_SUITE(U8) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::U8)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 9 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); -} -TEST_SUITE_END() // U8 - -TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), - framework::dataset::make("DataType", - DataType::S16)), - datasets::BorderModes()), - framework::dataset::make("filter_size", { 9 }))) -{ - // Validate output - validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); -} -TEST_SUITE_END() // S16 -TEST_SUITE_END() // Separable9x9 - -TEST_SUITE_END() // CustomConvolution -TEST_SUITE_END() // Neon -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/NEON/Remap.cpp b/tests/validation/NEON/Remap.cpp new file mode 100644 index 0000000000..3c02f8eece --- /dev/null +++ b/tests/validation/NEON/Remap.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2017-2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "arm_compute/core/Types.h" +#include "arm_compute/runtime/NEON/functions/NERemap.h" +#include "arm_compute/runtime/Tensor.h" +#include "arm_compute/runtime/TensorAllocator.h" +#include "tests/NEON/Accessor.h" +#include "tests/PaddingCalculator.h" +#include "tests/datasets/BorderModeDataset.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/RemapFixture.h" + +namespace arm_compute +{ +namespace test +{ +namespace validation +{ +namespace +{ +constexpr AbsoluteTolerance tolerance_value(0); +constexpr float tolerance_number = 0.f; +} // namespace + +TEST_SUITE(NEON) +TEST_SUITE(Remap) + +template +using NERemapFixture = RemapValidationFixture; + +FIXTURE_DATA_TEST_CASE(RunSmall, NERemapFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })), + framework::dataset::make("DataType", + DataType::U8)), + framework::dataset::make("BorderModes", { BorderMode::UNDEFINED, BorderMode::CONSTANT }))) +{ + // Validate output + validate(Accessor(_target), _reference, _valid_mask, tolerance_value, tolerance_number); +} + +FIXTURE_DATA_TEST_CASE(RunLarge, NERemapFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })), + framework::dataset::make("DataType", + DataType::U8)), + framework::dataset::make("BorderModes", { BorderMode::UNDEFINED, BorderMode::CONSTANT }))) +{ + // Validate output + validate(Accessor(_target), _reference, _valid_mask, tolerance_value, tolerance_number); +} +TEST_SUITE_END() +TEST_SUITE_END() +} // namespace validation +} // namespace test +} // namespace arm_compute diff --git a/tests/validation/fixtures/AbsoluteDifferenceFixture.h b/tests/validation/fixtures/AbsoluteDifferenceFixture.h deleted file mode 100644 index 46118c9323..0000000000 --- a/tests/validation/fixtures/AbsoluteDifferenceFixture.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_ABSOLUTE_DIFFERENCE_FIXTURE -#define ARM_COMPUTE_TEST_ABSOLUTE_DIFFERENCE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/Helpers.h" -#include "tests/validation/reference/AbsoluteDifference.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class AbsoluteDifferenceValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type0, DataType data_type1, DataType output_data_type) - { - _target = compute_target(shape, data_type0, data_type1, output_data_type); - _reference = compute_reference(shape, data_type0, data_type1, output_data_type); - } - -protected: - template - void fill(U &&tensor, int i) - { - library->fill_tensor_uniform(tensor, i); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) - { - // Create tensors - TensorType ref_src1 = create_tensor(shape, data_type0, 1); - TensorType ref_src2 = create_tensor(shape, data_type1, 1); - TensorType dst = create_tensor(shape, output_data_type, 1); - - // Create and configure function - FunctionType abs_diff; - abs_diff.configure(&ref_src1, &ref_src2, &dst); - - ARM_COMPUTE_EXPECT(ref_src1.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(ref_src2.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - ref_src1.allocator()->allocate(); - ref_src2.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!ref_src1.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!ref_src2.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(ref_src1), 0); - fill(AccessorType(ref_src2), 1); - - // Compute function - abs_diff.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) - { - // Create reference - SimpleTensor ref_src1{ shape, data_type0, 1 }; - SimpleTensor ref_src2{ shape, data_type1, 1 }; - - // Fill reference - fill(ref_src1, 0); - fill(ref_src2, 1); - - return reference::absolute_difference(ref_src1, ref_src2, output_data_type); - } - - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_ABSOLUTE_DIFFERENCE_FIXTURE */ diff --git a/tests/validation/fixtures/AccumulateFixture.h b/tests/validation/fixtures/AccumulateFixture.h deleted file mode 100644 index 7cea29c15d..0000000000 --- a/tests/validation/fixtures/AccumulateFixture.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_ACCUMULATE_FIXTURE -#define ARM_COMPUTE_TEST_ACCUMULATE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/Helpers.h" -#include "tests/validation/reference/Accumulate.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class AccumulateBaseValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type, DataType output_data_type) - { - _target = compute_target(shape, data_type, output_data_type); - _reference = compute_reference(shape, data_type, output_data_type); - } - -protected: - template - void fill(U &&tensor, int i, D max) - { - library->fill_tensor_uniform(tensor, i, static_cast(0), max); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type, DataType output_data_type) - { - // Create tensors - TensorType ref_src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, output_data_type); - - // Create and configure function - FunctionType accum; - accum_conf(accum, ref_src, dst); - - ARM_COMPUTE_EXPECT(ref_src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - ref_src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!ref_src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - const T1 max = std::numeric_limits::max(); - - // Fill tensors - fill(AccessorType(ref_src), 0, max); - fill(AccessorType(dst), 1, static_cast(max)); - - // Compute function - accum.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, DataType output_data_type) - { - // Create reference - SimpleTensor ref_src{ shape, data_type }; - - const T1 max = std::numeric_limits::max(); - - // Fill reference - fill(ref_src, 0, max); - - return accum_ref(ref_src, output_data_type); - } - - virtual void accum_conf(FunctionType &func, const TensorType &input, TensorType &accum) = 0; - - virtual SimpleTensor accum_ref(const SimpleTensor &input, DataType output_data_type) = 0; - - TensorType _target{}; - SimpleTensor _reference{}; -}; - -template -class AccumulateValidationFixture : public AccumulateBaseValidationFixture -{ -public: - template - void setup(TensorShape shape, DataType data_type, DataType output_data_type) - { - AccumulateBaseValidationFixture::setup(shape, data_type, output_data_type); - } - - virtual void accum_conf(FunctionType &func, const TensorType &input, TensorType &accum) override - { - func.configure(&input, &accum); - } - - virtual SimpleTensor accum_ref(const SimpleTensor &input, DataType output_data_type) override - { - return reference::accumulate(input, output_data_type); - } -}; - -template -class AccumulateWeightedValidationFixture : public AccumulateBaseValidationFixture -{ -public: - template - void setup(TensorShape shape, DataType data_type, DataType output_data_type) - { - std::mt19937 gen(library->seed()); - std::uniform_real_distribution float_dist(0, 1); - - _alpha = float_dist(gen); - - AccumulateBaseValidationFixture::setup(shape, data_type, output_data_type); - } - - virtual void accum_conf(FunctionType &func, const TensorType &input, TensorType &accum) override - { - func.configure(&input, _alpha, &accum); - } - - virtual SimpleTensor accum_ref(const SimpleTensor &input, DataType output_data_type) override - { - return reference::accumulate_weighted(input, _alpha, output_data_type); - } - - float _alpha{ 0.f }; -}; - -template -class AccumulateSquaredValidationFixture : public AccumulateBaseValidationFixture -{ -public: - template - void setup(TensorShape shape, DataType data_type, DataType output_data_type) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution int_dist(0, 15); - - _shift = int_dist(gen); - - AccumulateBaseValidationFixture::setup(shape, data_type, output_data_type); - } - - virtual void accum_conf(FunctionType &func, const TensorType &input, TensorType &accum) override - { - func.configure(&input, _shift, &accum); - } - - virtual SimpleTensor accum_ref(const SimpleTensor &input, DataType output_data_type) override - { - return reference::accumulate_squared(input, _shift, output_data_type); - } - - uint32_t _shift{ 0U }; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_ACCUMULATE_FIXTURE */ diff --git a/tests/validation/fixtures/Box3x3Fixture.h b/tests/validation/fixtures/Box3x3Fixture.h deleted file mode 100644 index 8caeec8400..0000000000 --- a/tests/validation/fixtures/Box3x3Fixture.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_BOX3X3_FIXTURE -#define ARM_COMPUTE_TEST_BOX3X3_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Box3x3.h" - -#include - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class Box3x3ValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type, BorderMode border_mode) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution distribution(0, 255); - const uint8_t constant_border_value = distribution(gen); - - _border_mode = border_mode; - _target = compute_target(shape, data_type, border_mode, constant_border_value); - _reference = compute_reference(shape, data_type, border_mode, constant_border_value); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type, BorderMode border_mode, uint8_t constant_border_value) - { - // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); - - // Create and configure function - FunctionType box3x3; - box3x3.configure(&src, &dst, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - box3x3.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, BorderMode border_mode, uint8_t constant_border_value) - { - ARM_COMPUTE_ERROR_ON(data_type != DataType::U8); - - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src); - - // Compute reference - return reference::box3x3(src, border_mode, constant_border_value); - } - - BorderMode _border_mode{}; - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_BOX3X3_FIXTURE */ diff --git a/tests/validation/fixtures/CannyEdgeFixture.h b/tests/validation/fixtures/CannyEdgeFixture.h deleted file mode 100644 index 8e82e6d2f0..0000000000 --- a/tests/validation/fixtures/CannyEdgeFixture.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2017-2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_CANNY_EDGE_FIXTURE -#define ARM_COMPUTE_TEST_CANNY_EDGE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/Helpers.h" -#include "tests/validation/reference/CannyEdgeDetector.h" - -namespace arm_compute -{ -class CLCannyEdge; -class NECannyEdge; - -namespace test -{ -namespace validation -{ -template -class CannyEdgeValidationFixture : public framework::Fixture -{ -public: - template - void setup(std::string image, int gradient_size, MagnitudeType norm_type, BorderMode border_mode, Format format) - { - CannyEdgeParameters params = canny_edge_parameters(); - - _target = compute_target(image, gradient_size, norm_type, border_mode, format, params); - _reference = compute_reference(image, gradient_size, norm_type, border_mode, format, params); - } - -protected: - template - void fill(U &&tensor, RawTensor raw) - { - library->fill(tensor, raw); - } - - TensorType compute_target(const std::string &image, int gradient_size, MagnitudeType norm_type, BorderMode border_mode, Format format, const CannyEdgeParameters ¶ms) - { - // Load the image (cached by the library if loaded before) - const RawTensor &raw = library->get(image, format); - - // Create tensors - TensorType src = create_tensor(raw.shape(), format); - TensorType dst = create_tensor(raw.shape(), format); - src.info()->set_format(format); - dst.info()->set_format(format); - - // Create Canny edge configure function - FunctionType canny_edge; - canny_edge.configure(&src, &dst, params.upper_thresh, params.lower_thresh, gradient_size, static_cast(norm_type) + 1, border_mode, params.constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src), raw); - - // Compute function - canny_edge.run(); - - return dst; - } - - SimpleTensor compute_reference(const std::string &image, int gradient_size, MagnitudeType norm_type, BorderMode border_mode, Format format, const CannyEdgeParameters ¶ms) - { - ARM_COMPUTE_ERROR_ON(format != Format::U8); - - // Load the image (cached by the library if loaded before) - const RawTensor &raw = library->get(image, format); - - // Create reference - SimpleTensor src{ raw.shape(), format }; - - // Fill reference - fill(src, raw); - - return reference::canny_edge_detector(src, params.upper_thresh, params.lower_thresh, gradient_size, norm_type, border_mode, params.constant_border_value); - } - - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_CANNY_EDGE_FIXTURE */ diff --git a/tests/validation/fixtures/ChannelCombineFixture.h b/tests/validation/fixtures/ChannelCombineFixture.h deleted file mode 100644 index f0d927a992..0000000000 --- a/tests/validation/fixtures/ChannelCombineFixture.h +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (c) 2017-2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_CHANNEL_COMBINE_FIXTURE -#define ARM_COMPUTE_TEST_CHANNEL_COMBINE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/Helpers.h" -#include "tests/validation/reference/ChannelCombine.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -template -inline std::vector create_tensor_planes(const TensorShape &shape, Format format) -{ - TensorShape image_shape = adjust_odd_shape(shape, format); - TensorInfo info(image_shape, Format::U8); - - std::vector tensor_planes; - - switch(format) - { - case Format::RGB888: - case Format::RGBA8888: - case Format::YUV444: - { - tensor_planes.resize(3); - - if(format == Format::RGBA8888) - { - tensor_planes.resize(4); - } - - for(unsigned int plane_idx = 0; plane_idx < tensor_planes.size(); ++plane_idx) - { - tensor_planes[plane_idx].allocator()->init(info); - } - - break; - } - case Format::YUYV422: - case Format::UYVY422: - { - const TensorShape uv_shape = calculate_subsampled_shape(image_shape, format); - const TensorInfo info_hor2(uv_shape, Format::U8); - - tensor_planes.resize(3); - - tensor_planes[0].allocator()->init(info); - tensor_planes[1].allocator()->init(info_hor2); - tensor_planes[2].allocator()->init(info_hor2); - break; - } - case Format::NV12: - case Format::NV21: - case Format::IYUV: - { - const TensorShape sub2_shape = calculate_subsampled_shape(image_shape, format); - const TensorInfo info_sub2(sub2_shape, Format::U8); - - tensor_planes.resize(3); - - tensor_planes[0].allocator()->init(info); - tensor_planes[1].allocator()->init(info_sub2); - tensor_planes[2].allocator()->init(info_sub2); - break; - } - default: - ARM_COMPUTE_ERROR("Not supported"); - break; - } - - return tensor_planes; -} -} // namespace - -template -class ChannelCombineValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, Format format) - { - _num_planes = num_planes_from_format(format); - _target = compute_target(shape, format); - _reference = compute_reference(shape, format); - } - -protected: - template - void fill(U &&tensor, int i) - { - library->fill_tensor_uniform(tensor, i); - } - - template - std::vector> create_tensor_planes_reference(const TensorShape &shape, Format format) - { - std::vector> tensor_planes; - - TensorShape image_shape = adjust_odd_shape(shape, format); - - switch(format) - { - case Format::RGB888: - case Format::RGBA8888: - case Format::YUV444: - { - if(format == Format::RGBA8888) - { - tensor_planes.emplace_back(image_shape, Format::U8); - } - - tensor_planes.emplace_back(image_shape, Format::U8); - tensor_planes.emplace_back(image_shape, Format::U8); - tensor_planes.emplace_back(image_shape, Format::U8); - break; - } - case Format::YUYV422: - case Format::UYVY422: - { - const TensorShape hor2_shape = calculate_subsampled_shape(image_shape, format); - - tensor_planes.emplace_back(image_shape, Format::U8); - tensor_planes.emplace_back(hor2_shape, Format::U8); - tensor_planes.emplace_back(hor2_shape, Format::U8); - break; - } - case Format::NV12: - case Format::NV21: - case Format::IYUV: - { - const TensorShape shape_sub2 = calculate_subsampled_shape(image_shape, format); - - tensor_planes.emplace_back(image_shape, Format::U8); - tensor_planes.emplace_back(shape_sub2, Format::U8); - tensor_planes.emplace_back(shape_sub2, Format::U8); - break; - } - default: - ARM_COMPUTE_ERROR("Not supported"); - break; - } - - return tensor_planes; - } - - MultiImageType compute_target(const TensorShape &shape, Format format) - { - // Create tensors - std::vector ref_src = create_tensor_planes(shape, format); - MultiImageType dst = create_multi_image(shape, format); - - // Create and configure function - FunctionType channel_combine; - - if(1 == _num_planes) - { - const TensorType *tensor_extra = ((Format::RGBA8888 == format) ? &ref_src[3] : nullptr); - TensorType *tensor_dst = dynamic_cast(dst.plane(0)); - - channel_combine.configure(&ref_src[0], &ref_src[1], &ref_src[2], tensor_extra, tensor_dst); - } - else - { - channel_combine.configure(&ref_src[0], &ref_src[1], &ref_src[2], &dst); - } - - for(unsigned int plane_idx = 0; plane_idx < _num_planes; ++plane_idx) - { - const TensorType *dst_plane = static_cast(dst.plane(plane_idx)); - - ARM_COMPUTE_EXPECT(dst_plane->info()->is_resizable(), framework::LogLevel::ERRORS); - } - - for(unsigned int plane_idx = 0; plane_idx < ref_src.size(); ++plane_idx) - { - ARM_COMPUTE_EXPECT(ref_src[plane_idx].info()->is_resizable(), framework::LogLevel::ERRORS); - } - - // Allocate tensors - dst.allocate(); - - for(unsigned int plane_idx = 0; plane_idx < ref_src.size(); ++plane_idx) - { - ref_src[plane_idx].allocator()->allocate(); - } - - for(unsigned int plane_idx = 0; plane_idx < _num_planes; ++plane_idx) - { - const TensorType *dst_plane = static_cast(dst.plane(plane_idx)); - - ARM_COMPUTE_EXPECT(!dst_plane->info()->is_resizable(), framework::LogLevel::ERRORS); - } - - for(unsigned int plane_idx = 0; plane_idx < ref_src.size(); ++plane_idx) - { - ARM_COMPUTE_EXPECT(!ref_src[plane_idx].info()->is_resizable(), framework::LogLevel::ERRORS); - } - - // Fill tensor planes - for(unsigned int plane_idx = 0; plane_idx < ref_src.size(); ++plane_idx) - { - fill(AccessorType(ref_src[plane_idx]), plane_idx); - } - - // Compute function - channel_combine.run(); - - return dst; - } - - std::vector> compute_reference(const TensorShape &shape, Format format) - { - // Create reference - std::vector> ref_src = create_tensor_planes_reference(shape, format); - - // Fill references - for(unsigned int plane_idx = 0; plane_idx < ref_src.size(); ++plane_idx) - { - fill(ref_src[plane_idx], plane_idx); - } - - return reference::channel_combine(shape, ref_src, format); - } - - unsigned int _num_planes{}; - MultiImageType _target{}; - std::vector> _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_CHANNEL_COMBINE_FIXTURE */ diff --git a/tests/validation/fixtures/ChannelExtractFixture.h b/tests/validation/fixtures/ChannelExtractFixture.h deleted file mode 100644 index 2f5694fcb1..0000000000 --- a/tests/validation/fixtures/ChannelExtractFixture.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2017-2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_CHANNEL_EXTRACT_FIXTURE -#define ARM_COMPUTE_TEST_CHANNEL_EXTRACT_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/Helpers.h" -#include "tests/validation/reference/ChannelExtract.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class ChannelExtractValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, Format format, Channel channel) - { - shape = adjust_odd_shape(shape, format); - - _target = compute_target(shape, format, channel); - _reference = compute_reference(shape, format, channel); - } - -protected: - template - void fill(U &&tensor, int i) - { - library->fill_tensor_uniform(tensor, i); - } - - std::vector> create_tensor_planes_reference(const TensorShape &shape, Format format) - { - TensorShape input = adjust_odd_shape(shape, format); - - std::vector> tensor_planes; - - switch(format) - { - case Format::RGB888: - case Format::RGBA8888: - case Format::YUYV422: - case Format::UYVY422: - { - tensor_planes.emplace_back(input, format); - break; - } - case Format::NV12: - case Format::NV21: - { - const TensorShape shape_uv88 = calculate_subsampled_shape(shape, Format::UV88); - - tensor_planes.emplace_back(input, Format::U8); - tensor_planes.emplace_back(shape_uv88, Format::UV88); - break; - } - case Format::IYUV: - { - const TensorShape shape_sub2 = calculate_subsampled_shape(shape, Format::IYUV); - - tensor_planes.emplace_back(input, Format::U8); - tensor_planes.emplace_back(shape_sub2, Format::U8); - tensor_planes.emplace_back(shape_sub2, Format::U8); - break; - } - case Format::YUV444: - tensor_planes.emplace_back(input, Format::U8); - tensor_planes.emplace_back(input, Format::U8); - tensor_planes.emplace_back(input, Format::U8); - break; - default: - ARM_COMPUTE_ERROR("Not supported"); - break; - } - - return tensor_planes; - } - - TensorType compute_target(const TensorShape &shape, Format format, Channel channel) - { - const unsigned int num_planes = num_planes_from_format(format); - - TensorShape dst_shape = calculate_subsampled_shape(shape, format, channel); - - // Create tensors - MultiImageType ref_src = create_multi_image(shape, format); - TensorType dst = create_tensor(dst_shape, Format::U8); - - // Create and configure function - FunctionType channel_extract; - - if(1U == num_planes) - { - const TensorType *plane_src = static_cast(ref_src.plane(0)); - - channel_extract.configure(plane_src, channel, &dst); - } - else - { - channel_extract.configure(&ref_src, channel, &dst); - } - - for(unsigned int plane_idx = 0; plane_idx < num_planes; ++plane_idx) - { - const TensorType *src_plane = static_cast(ref_src.plane(plane_idx)); - - ARM_COMPUTE_EXPECT(src_plane->info()->is_resizable(), framework::LogLevel::ERRORS); - } - - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - ref_src.allocate(); - dst.allocator()->allocate(); - - for(unsigned int plane_idx = 0; plane_idx < num_planes; ++plane_idx) - { - const TensorType *src_plane = static_cast(ref_src.plane(plane_idx)); - - ARM_COMPUTE_EXPECT(!src_plane->info()->is_resizable(), framework::LogLevel::ERRORS); - } - - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensor planes - for(unsigned int plane_idx = 0; plane_idx < num_planes; ++plane_idx) - { - TensorType *src_plane = static_cast(ref_src.plane(plane_idx)); - - fill(AccessorType(*src_plane), plane_idx); - } - - // Compute function - channel_extract.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, Format format, Channel channel) - { - const unsigned int num_planes = num_planes_from_format(format); - - // Create reference - std::vector> ref_src = create_tensor_planes_reference(shape, format); - - // Fill references - for(unsigned int plane_idx = 0; plane_idx < num_planes; ++plane_idx) - { - fill(ref_src[plane_idx], plane_idx); - } - - return reference::channel_extract(shape, ref_src, format, channel); - } - - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_CHANNEL_EXTRACT_FIXTURE */ diff --git a/tests/validation/fixtures/ColorConvertFixture.h b/tests/validation/fixtures/ColorConvertFixture.h deleted file mode 100644 index a5ed5548d5..0000000000 --- a/tests/validation/fixtures/ColorConvertFixture.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2017-2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_COLOR_CONVERT_FIXTURE -#define ARM_COMPUTE_TEST_COLOR_CONVERT_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/Helpers.h" -#include "tests/validation/reference/ColorConvert.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -} -template -class ColorConvertValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, Format src_format, Format dst_format) - { - shape = adjust_odd_shape(shape, src_format); - shape = adjust_odd_shape(shape, dst_format); - - _target = compute_target(shape, src_format, dst_format); - _reference = compute_reference(shape, src_format, dst_format); - } - -protected: - template - void fill(U &&tensor, int i) - { - library->fill_tensor_uniform(tensor, i); - } - - std::vector> create_tensor_planes_reference(const TensorShape &shape, Format format) - { - std::vector> tensor_planes; - - switch(format) - { - case Format::RGB888: - case Format::RGBA8888: - case Format::YUYV422: - case Format::UYVY422: - { - tensor_planes.emplace_back(shape, format); - break; - } - case Format::NV12: - case Format::NV21: - { - const TensorShape shape_uv88 = calculate_subsampled_shape(shape, Format::UV88); - - tensor_planes.emplace_back(shape, Format::U8); - tensor_planes.emplace_back(shape_uv88, Format::UV88); - break; - } - case Format::IYUV: - { - const TensorShape shape_sub2 = calculate_subsampled_shape(shape, Format::IYUV); - - tensor_planes.emplace_back(shape, Format::U8); - tensor_planes.emplace_back(shape_sub2, Format::U8); - tensor_planes.emplace_back(shape_sub2, Format::U8); - break; - } - case Format::YUV444: - { - tensor_planes.emplace_back(shape, Format::U8); - tensor_planes.emplace_back(shape, Format::U8); - tensor_planes.emplace_back(shape, Format::U8); - break; - } - default: - ARM_COMPUTE_ERROR("Not supported"); - break; - } - - return tensor_planes; - } - - MultiImageType compute_target(const TensorShape &shape, Format src_format, Format dst_format) - { - _src_num_planes = num_planes_from_format(src_format); - _dst_num_planes = num_planes_from_format(dst_format); - - // Create tensors - MultiImageType ref_src = create_multi_image(shape, src_format); - MultiImageType ref_dst = create_multi_image(shape, dst_format); - - // Create and configure function - FunctionType color_convert; - - if(1U == _src_num_planes) - { - const TensorType *plane_src = static_cast(ref_src.plane(0)); - - if(1U == _dst_num_planes) - { - TensorType *plane_dst = static_cast(ref_dst.plane(0)); - color_convert.configure(plane_src, plane_dst); - } - else - { - color_convert.configure(plane_src, &ref_dst); - } - } - else - { - if(1U == _dst_num_planes) - { - TensorType *plane_dst = static_cast(ref_dst.plane(0)); - color_convert.configure(&ref_src, plane_dst); - } - else - { - color_convert.configure(&ref_src, &ref_dst); - } - } - - for(unsigned int plane_idx = 0; plane_idx < _src_num_planes; ++plane_idx) - { - const TensorType *src_plane = static_cast(ref_src.plane(plane_idx)); - - ARM_COMPUTE_EXPECT(src_plane->info()->is_resizable(), framework::LogLevel::ERRORS); - } - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - const TensorType *dst_plane = static_cast(ref_dst.plane(plane_idx)); - - ARM_COMPUTE_EXPECT(dst_plane->info()->is_resizable(), framework::LogLevel::ERRORS); - } - - // Allocate tensors - ref_src.allocate(); - ref_dst.allocate(); - - for(unsigned int plane_idx = 0; plane_idx < _src_num_planes; ++plane_idx) - { - const TensorType *src_plane = static_cast(ref_src.plane(plane_idx)); - ARM_COMPUTE_EXPECT(!src_plane->info()->is_resizable(), framework::LogLevel::ERRORS); - } - - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - const TensorType *dst_plane = static_cast(ref_dst.plane(plane_idx)); - ARM_COMPUTE_EXPECT(!dst_plane->info()->is_resizable(), framework::LogLevel::ERRORS); - } - - // Fill tensor planes - for(unsigned int plane_idx = 0; plane_idx < _src_num_planes; ++plane_idx) - { - TensorType *src_plane = static_cast(ref_src.plane(plane_idx)); - - fill(AccessorType(*src_plane), plane_idx); - } - - // Compute function - color_convert.run(); - - return ref_dst; - } - - std::vector> compute_reference(const TensorShape &shape, Format src_format, Format dst_format) - { - // Create reference - std::vector> ref_src = create_tensor_planes_reference(shape, src_format); - - // Fill references - for(unsigned int plane_idx = 0; plane_idx < ref_src.size(); ++plane_idx) - { - fill(ref_src[plane_idx], plane_idx); - } - - return reference::color_convert(shape, ref_src, src_format, dst_format); - } - - unsigned int _src_num_planes{}; - unsigned int _dst_num_planes{}; - MultiImageType _target{}; - std::vector> _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_COLOR_CONVERT_FIXTURE */ diff --git a/tests/validation/fixtures/ConvolutionFixture.h b/tests/validation/fixtures/ConvolutionFixture.h deleted file mode 100644 index 4692e2faf8..0000000000 --- a/tests/validation/fixtures/ConvolutionFixture.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_CONVOLUTION_FIXTURE -#define ARM_COMPUTE_TEST_CONVOLUTION_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Convolution.h" - -#include - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class ConvolutionValidationFixture : public framework::Fixture -{ -protected: - template - void setup(TensorShape shape, DataType output_data_type, BorderMode border_mode, const unsigned int width, const unsigned int height, const bool is_separable = false) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution distribution(0, 255); - std::uniform_int_distribution scale_distribution(1, 255); - const uint8_t constant_border_value = distribution(gen); - - // Generate random scale value between 1 and 255. - const uint32_t scale = scale_distribution(gen); - - ARM_COMPUTE_ERROR_ON(3 != width && 5 != width && 7 != width && 9 != width); - ARM_COMPUTE_ERROR_ON(3 != height && 5 != height && 7 != height && 9 != height); - - std::vector conv(width * height); - - _width = width; - _height = height; - - if(is_separable) - { - init_separable_conv(conv.data(), width, height, library->seed()); - } - else - { - init_conv(conv.data(), width, height, library->seed()); - } - - _target = compute_target(shape, output_data_type, conv.data(), scale, border_mode, constant_border_value); - _reference = compute_reference(shape, output_data_type, conv.data(), scale, border_mode, constant_border_value); - } - - template - void fill(U &&tensor, int i) - { - library->fill_tensor_uniform(tensor, i); - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) - { - // Create reference - SimpleTensor src{ shape, DataType::U8 }; - - // Fill reference - fill(src, 0); - - // Compute reference - return reference::convolution(src, output_data_type, conv, scale, border_mode, constant_border_value, _width, _height); - } - - virtual TensorType compute_target(const TensorShape &shape, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) = 0; - - BorderMode _border_mode{}; - TensorType _target{}; - SimpleTensor _reference{}; - unsigned int _width{}; - unsigned int _height{}; -}; - -template -class ConvolutionSquareValidationFixture : public ConvolutionValidationFixture -{ -public: - template - void setup(TensorShape shape, DataType output_data_type, BorderMode border_mode, const unsigned int width) - { - ConvolutionValidationFixture::setup(shape, output_data_type, border_mode, width, width); - } - -protected: - TensorType compute_target(const TensorShape &shape, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) - { - // Create tensors - TensorType src = create_tensor(shape, DataType::U8); - TensorType dst = create_tensor(shape, output_data_type); - - // Create and configure function - FunctionType convolution; - convolution.configure(&src, &dst, conv, scale, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - this->fill(AccessorType(src), 0); - this->fill(AccessorType(dst), 1); - - // Compute function - convolution.run(); - - return dst; - } -}; - -template -class ConvolutionSeparableValidationFixture : public ConvolutionValidationFixture -{ -public: - template - void setup(TensorShape shape, DataType output_data_type, BorderMode border_mode, const unsigned int width) - { - ConvolutionValidationFixture::setup(shape, output_data_type, border_mode, width, width, true); - } - -protected: - TensorType compute_target(const TensorShape &shape, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) - { - // Create tensors - TensorType src = create_tensor(shape, DataType::U8); - TensorType dst = create_tensor(shape, output_data_type); - - // Create and configure function - FunctionType convolution; - convolution.configure(&src, &dst, conv, scale, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - this->fill(AccessorType(src), 0); - this->fill(AccessorType(dst), 1); - - // Compute function - convolution.run(); - - return dst; - } -}; - -template -class ConvolutionRectangleValidationFixture : public ConvolutionValidationFixture -{ -public: - template - void setup(TensorShape shape, DataType output_data_type, BorderMode border_mode, const unsigned int width, const unsigned int height) - { - ConvolutionValidationFixture::setup(shape, output_data_type, border_mode, width, height); - } - -protected: - TensorType compute_target(const TensorShape &shape, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) - { - // Create tensors - TensorType src = create_tensor(shape, DataType::U8); - TensorType dst = create_tensor(shape, output_data_type); - - // Create and configure function - FunctionType convolution; - convolution.configure(&src, &dst, conv, this->_width, this->_height, scale, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - this->fill(AccessorType(src), 0); - this->fill(AccessorType(dst), 1); - - // Compute function - convolution.run(); - - return dst; - } -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_CONVOLUTION_FIXTURE */ diff --git a/tests/validation/fixtures/DerivativeFixture.h b/tests/validation/fixtures/DerivativeFixture.h deleted file mode 100644 index e520a9e14e..0000000000 --- a/tests/validation/fixtures/DerivativeFixture.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_DERIVATIVE_FIXTURE -#define ARM_COMPUTE_TEST_DERIVATIVE_FIXTURE - -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/Types.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Derivative.h" - -#include - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class DerivativeValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, BorderMode border_mode, Format format, GradientDimension gradient_dimension) - { - // Generate a random constant value - std::mt19937 gen(library->seed()); - std::uniform_int_distribution int_dist(0, 255); - const uint8_t constant_border_value = int_dist(gen); - - _border_mode = border_mode; - _target = compute_target(shape, border_mode, format, constant_border_value, gradient_dimension); - _reference = compute_reference(shape, border_mode, format, constant_border_value, gradient_dimension); - } - -protected: - template - void fill(V &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - template - void fill_zero(V &&tensor) - { - library->fill_tensor_uniform(tensor, 0, static_cast(0), static_cast(0)); - } - - std::pair compute_target(const TensorShape &shape, BorderMode border_mode, Format format, uint8_t constant_border_value, GradientDimension gradient_dimension) - { - // Create tensors - TensorType src = create_tensor(shape, data_type_from_format(format)); - TensorType dst_x = create_tensor(shape, data_type_from_format(Format::S16)); - TensorType dst_y = create_tensor(shape, data_type_from_format(Format::S16)); - - src.info()->set_format(format); - dst_x.info()->set_format(Format::S16); - dst_y.info()->set_format(Format::S16); - - FunctionType derivative; - - switch(gradient_dimension) - { - case GradientDimension::GRAD_X: - derivative.configure(&src, &dst_x, nullptr, border_mode, constant_border_value); - break; - case GradientDimension::GRAD_Y: - derivative.configure(&src, nullptr, &dst_y, border_mode, constant_border_value); - break; - case GradientDimension::GRAD_XY: - derivative.configure(&src, &dst_x, &dst_y, border_mode, constant_border_value); - break; - default: - ARM_COMPUTE_ERROR("Gradient dimension not supported"); - } - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst_x.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst_y.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst_x.allocator()->allocate(); - dst_y.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst_x.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst_y.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - fill_zero(AccessorType(dst_x)); - fill_zero(AccessorType(dst_y)); - - // Compute function - derivative.run(); - - return std::make_pair(std::move(dst_x), std::move(dst_y)); - } - - std::pair, SimpleTensor> compute_reference(const TensorShape &shape, BorderMode border_mode, Format format, uint8_t constant_border_value, GradientDimension gradient_dimension) - { - // Create reference - SimpleTensor src{ shape, format }; - - // Fill reference - fill(src); - - return reference::derivative(src, border_mode, constant_border_value, gradient_dimension); - } - - BorderMode _border_mode{ BorderMode::UNDEFINED }; - std::pair _target{}; - std::pair, SimpleTensor> _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DERIVATIVE_FIXTURE */ diff --git a/tests/validation/fixtures/DilateFixture.h b/tests/validation/fixtures/DilateFixture.h deleted file mode 100644 index 51ed4df2d3..0000000000 --- a/tests/validation/fixtures/DilateFixture.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_DILATE_FIXTURE -#define ARM_COMPUTE_TEST_DILATE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Dilate.h" - -#include - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class DilateValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type, BorderMode border_mode) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution distribution(0, 255); - const uint8_t constant_border_value = distribution(gen); - - _border_mode = border_mode; - _target = compute_target(shape, data_type, border_mode, constant_border_value); - _reference = compute_reference(shape, data_type, border_mode, constant_border_value); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type, BorderMode border_mode, uint8_t constant_border_value) - { - // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); - - // Create and configure function - FunctionType dilate; - dilate.configure(&src, &dst, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - dilate.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, BorderMode border_mode, uint8_t constant_border_value) - { - ARM_COMPUTE_ERROR_ON(data_type != DataType::U8); - - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src); - - // Compute reference - return reference::dilate(src, border_mode, constant_border_value); - } - - BorderMode _border_mode{}; - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DILATE_FIXTURE */ diff --git a/tests/validation/fixtures/EqualizeHistogramFixture.h b/tests/validation/fixtures/EqualizeHistogramFixture.h deleted file mode 100644 index f7a0312747..0000000000 --- a/tests/validation/fixtures/EqualizeHistogramFixture.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2017-2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_EQUALIZE_HISTOGRAM_FIXTURE -#define ARM_COMPUTE_TEST_EQUALIZE_HISTOGRAM_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/EqualizeHistogram.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class EqualizeHistogramValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type) - { - _target = compute_target(shape, data_type); - _reference = compute_reference(shape, data_type); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type) - { - // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); - - // Create and configure function - FunctionType equalize_histogram; - - equalize_histogram.configure(&src, &dst); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - equalize_histogram.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type) - { - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src); - - return reference::equalize_histogram(src); - } - - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_EQUALIZE_HISTOGRAM_FIXTURE */ diff --git a/tests/validation/fixtures/ErodeFixture.h b/tests/validation/fixtures/ErodeFixture.h deleted file mode 100644 index b9f17a266a..0000000000 --- a/tests/validation/fixtures/ErodeFixture.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_ERODE_FIXTURE -#define ARM_COMPUTE_TEST_ERODE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Erode.h" - -#include - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class ErodeValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type, BorderMode border_mode) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution distribution(0, 255); - const uint8_t constant_border_value = distribution(gen); - - _border_mode = border_mode; - _target = compute_target(shape, data_type, border_mode, constant_border_value); - _reference = compute_reference(shape, data_type, border_mode, constant_border_value); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type, BorderMode border_mode, uint8_t constant_border_value) - { - // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); - - // Create and configure function - FunctionType erode; - erode.configure(&src, &dst, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - erode.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, BorderMode border_mode, uint8_t constant_border_value) - { - ARM_COMPUTE_ERROR_ON(data_type != DataType::U8); - - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src); - - // Compute reference - return reference::erode(src, border_mode, constant_border_value); - } - - BorderMode _border_mode{}; - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_ERODE_FIXTURE */ diff --git a/tests/validation/fixtures/FastCornersFixture.h b/tests/validation/fixtures/FastCornersFixture.h deleted file mode 100644 index ae66c375ef..0000000000 --- a/tests/validation/fixtures/FastCornersFixture.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2017-2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_FAST_CORNERS_FIXTURE -#define ARM_COMPUTE_TEST_FAST_CORNERS_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/FastCorners.h" - -#include - -namespace arm_compute -{ -class CLFastCorners; -class NEFastCorners; - -namespace test -{ -namespace validation -{ -template -class FastCornersValidationFixture : public framework::Fixture -{ -public: - template - void setup(std::string image, Format format, bool suppress_nonmax, BorderMode border_mode) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution int_dist(0, 255); - std::uniform_real_distribution real_dist(0, 255); - - const uint8_t constant_border_value = int_dist(gen); - const float threshold = real_dist(gen); - - _target = compute_target(image, format, threshold, suppress_nonmax, border_mode, constant_border_value); - _reference = compute_reference(image, format, threshold, suppress_nonmax, border_mode, constant_border_value); - } - -protected: - template - void fill(U &&tensor, RawTensor raw) - { - library->fill(tensor, raw); - } - - template ::value, int>::type = 0> - void configure_target(F &func, TensorType &src, ArrayType &corners, unsigned int *num_corners, float threshold, bool suppress_nonmax, BorderMode border_mode, uint8_t constant_border_value) - { - func.configure(&src, threshold, suppress_nonmax, &corners, num_corners, border_mode, constant_border_value); - } - - template ::value, int>::type = 0> - void configure_target(F &func, TensorType &src, ArrayType &corners, unsigned int *num_corners, float threshold, bool suppress_nonmax, BorderMode border_mode, uint8_t constant_border_value) - { - ARM_COMPUTE_UNUSED(num_corners); - func.configure(&src, threshold, suppress_nonmax, &corners, border_mode, constant_border_value); - } - - ArrayType compute_target(const std::string &image, Format format, float threshold, bool suppress_nonmax, BorderMode border_mode, uint8_t constant_border_value) - { - // Load the image (cached by the library if loaded before) - const RawTensor &raw = library->get(image, format); - - // Create tensors - TensorType src = create_tensor(raw.shape(), format); - - // Create array of keypoints - ArrayType corners(raw.shape().total_size()); - unsigned int num_corners = raw.shape().total_size(); - - // Create and configure function - FunctionType fast_corners; - configure_target(fast_corners, src, corners, &num_corners, threshold, suppress_nonmax, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src), raw); - - // Compute function - fast_corners.run(); - - return corners; - } - - std::vector compute_reference(const std::string &image, Format format, float threshold, bool suppress_nonmax, BorderMode border_mode, uint8_t constant_border_value) - { - // Load the image (cached by the library if loaded before) - const RawTensor &raw = library->get(image, format); - - // Create reference - SimpleTensor src{ raw.shape(), format }; - - // Fill reference - fill(src, raw); - - // Compute reference - return reference::fast_corners(src, threshold, suppress_nonmax, border_mode, constant_border_value); - } - - ArrayType _target{}; - std::vector _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_FAST_CORNERS_FIXTURE */ diff --git a/tests/validation/fixtures/Gaussian3x3Fixture.h b/tests/validation/fixtures/Gaussian3x3Fixture.h deleted file mode 100644 index 4a154ea0d1..0000000000 --- a/tests/validation/fixtures/Gaussian3x3Fixture.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_GAUSSIAN3X3_FIXTURE -#define ARM_COMPUTE_TEST_GAUSSIAN3X3_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Gaussian3x3.h" - -#include - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class Gaussian3x3ValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type, BorderMode border_mode) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution distribution(0, 255); - const uint8_t constant_border_value = distribution(gen); - - _border_mode = border_mode; - _target = compute_target(shape, data_type, border_mode, constant_border_value); - _reference = compute_reference(shape, data_type, border_mode, constant_border_value); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type, BorderMode border_mode, uint8_t constant_border_value) - { - // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); - - // Create and configure function - FunctionType gaussian3x3; - gaussian3x3.configure(&src, &dst, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - gaussian3x3.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, BorderMode border_mode, uint8_t constant_border_value) - { - ARM_COMPUTE_ERROR_ON(data_type != DataType::U8); - - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src); - - // Compute reference - return reference::gaussian3x3(src, border_mode, constant_border_value); - } - - BorderMode _border_mode{}; - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_GAUSSIAN3X3_FIXTURE */ diff --git a/tests/validation/fixtures/Gaussian5x5Fixture.h b/tests/validation/fixtures/Gaussian5x5Fixture.h deleted file mode 100644 index 68f91e1656..0000000000 --- a/tests/validation/fixtures/Gaussian5x5Fixture.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_GAUSSIAN5X5_FIXTURE -#define ARM_COMPUTE_TEST_GAUSSIAN5X5_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Gaussian5x5.h" - -#include - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class Gaussian5x5ValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type, BorderMode border_mode) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution distribution(0, 255); - const uint8_t constant_border_value = distribution(gen); - - _border_mode = border_mode; - _target = compute_target(shape, data_type, border_mode, constant_border_value); - _reference = compute_reference(shape, data_type, border_mode, constant_border_value); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type, BorderMode border_mode, uint8_t constant_border_value) - { - // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); - - // Create and configure function - FunctionType gaussian5x5; - gaussian5x5.configure(&src, &dst, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - gaussian5x5.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, BorderMode border_mode, uint8_t constant_border_value) - { - ARM_COMPUTE_ERROR_ON(data_type != DataType::U8); - - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src); - - // Compute reference - return reference::gaussian5x5(src, border_mode, constant_border_value); - } - - BorderMode _border_mode{}; - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_GAUSSIAN5X5_FIXTURE */ diff --git a/tests/validation/fixtures/GaussianPyramidHalfFixture.h b/tests/validation/fixtures/GaussianPyramidHalfFixture.h deleted file mode 100644 index f91b1d520d..0000000000 --- a/tests/validation/fixtures/GaussianPyramidHalfFixture.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_GAUSSIAN_PYRAMID_HALF_FIXTURE -#define ARM_COMPUTE_TEST_GAUSSIAN_PYRAMID_HALF_FIXTURE - -#include "arm_compute/core/IPyramid.h" -#include "arm_compute/core/PyramidInfo.h" -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/GaussianPyramidHalf.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class GaussianPyramidHalfValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, BorderMode border_mode, size_t num_levels) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution distribution(0, 255); - const uint8_t constant_border_value = distribution(gen); - - _border_mode = border_mode; - - // Compute target and reference - compute_target(shape, border_mode, constant_border_value, num_levels); - compute_reference(shape, border_mode, constant_border_value, num_levels); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - void compute_target(const TensorShape &shape, BorderMode border_mode, uint8_t constant_border_value, size_t num_levels) - { - // Create tensors - TensorType src = create_tensor(shape, DataType::U8); - - PyramidInfo pyramid_info(num_levels, SCALE_PYRAMID_HALF, shape, Format::U8); - _target.init(pyramid_info); - - // Create and configure function - FunctionType gaussian_pyramid; - - gaussian_pyramid.configure(&src, &_target, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - for(size_t i = 0; i < pyramid_info.num_levels(); ++i) - { - ARM_COMPUTE_EXPECT(_target.get_pyramid_level(i)->info()->is_resizable(), framework::LogLevel::ERRORS); - } - - // Allocate input tensor - src.allocator()->allocate(); - - // Allocate pyramid - _target.allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - for(size_t i = 0; i < pyramid_info.num_levels(); ++i) - { - ARM_COMPUTE_EXPECT(!_target.get_pyramid_level(i)->info()->is_resizable(), framework::LogLevel::ERRORS); - } - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - gaussian_pyramid.run(); - } - - void compute_reference(const TensorShape &shape, BorderMode border_mode, uint8_t constant_border_value, size_t num_levels) - { - // Create reference - SimpleTensor src{ shape, DataType::U8 }; - - // Fill reference - fill(src); - - _reference = reference::gaussian_pyramid_half(src, border_mode, constant_border_value, num_levels); - } - - PyramidType _target{}; - std::vector> _reference{}; - BorderMode _border_mode{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_GAUSSIAN_PYRAMID_HALF_FIXTURE */ \ No newline at end of file diff --git a/tests/validation/fixtures/HOGDescriptorFixture.h b/tests/validation/fixtures/HOGDescriptorFixture.h deleted file mode 100644 index 1021e12d72..0000000000 --- a/tests/validation/fixtures/HOGDescriptorFixture.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2017-2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_HOG_DESCRIPTOR_FIXTURE -#define ARM_COMPUTE_TEST_HOG_DESCRIPTOR_FIXTURE - -#include "arm_compute/core/HOGInfo.h" -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/HOGDescriptor.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class HOGDescriptorValidationFixture : public framework::Fixture -{ -public: - template - void setup(std::string image, HOGInfo hog_info, Format format, BorderMode border_mode) - { - // Only defined borders supported - ARM_COMPUTE_ERROR_ON(border_mode == BorderMode::UNDEFINED); - - // Generate a random constant value - std::mt19937 gen(library->seed()); - std::uniform_int_distribution int_dist(0, 255); - const T constant_border_value = int_dist(gen); - - _target = compute_target(image, format, border_mode, constant_border_value, hog_info); - _reference = compute_reference(image, format, border_mode, constant_border_value, hog_info); - } - -protected: - template - void fill(V &&tensor, const std::string image, Format format) - { - library->fill(tensor, image, format); - } - - template - void fill(V &&tensor, int i, D max) - { - library->fill_tensor_uniform(tensor, i, static_cast(0), max); - } - - TensorType compute_target(const std::string image, Format &format, BorderMode &border_mode, T constant_border_value, const HOGInfo &hog_info) - { - // Get image shape for src tensor - TensorShape shape = library->get_image_shape(image); - - // Create tensor info for HOG descriptor - TensorInfo tensor_info_hog_descriptor(hog_info, shape.x(), shape.y()); - - // Create HOG - HOGType hog = create_HOG(hog_info); - - // Create tensors - TensorType src = create_tensor(shape, data_type_from_format(format)); - TensorType dst = create_tensor(tensor_info_hog_descriptor.tensor_shape(), DataType::F32, tensor_info_hog_descriptor.num_channels()); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Create and configure function - FunctionType hog_descriptor; - hog_descriptor.configure(&src, &dst, &hog, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - const T max = std::numeric_limits::max(); - - // Fill tensors - fill(AccessorType(src), image, format); - fill(AccessorType(dst), 1, static_cast(max)); - - // Compute function - hog_descriptor.run(); - - return dst; - } - - SimpleTensor compute_reference(const std::string image, Format format, BorderMode border_mode, T constant_border_value, const HOGInfo &hog_info) - { - // Create reference - SimpleTensor src{ library->get_image_shape(image), data_type_from_format(format) }; - - // Fill reference - fill(src, image, format); - - return reference::hog_descriptor(src, border_mode, constant_border_value, hog_info); - } - - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_HOG_DESCRIPTOR_FIXTURE */ diff --git a/tests/validation/fixtures/HOGDetectorFixture.h b/tests/validation/fixtures/HOGDetectorFixture.h deleted file mode 100644 index f12e65b75c..0000000000 --- a/tests/validation/fixtures/HOGDetectorFixture.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_HOG_DETECTOR_FIXTURE -#define ARM_COMPUTE_TEST_HOG_DETECTOR_FIXTURE - -#include "arm_compute/core/HOGInfo.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/IHOGAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/fixtures/HOGDescriptorFixture.h" -#include "tests/validation/reference/HOGDetector.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class HOGDetectorValidationFixture : public HOGDescriptorValidationFixture -{ -public: - template - void setup(Size2D detection_window_stride, std::string image, HOGInfo hog_info, Format format, BorderMode border_mode) - { - using HDF = HOGDescriptorValidationFixture; - HDF::setup(image, hog_info, format, border_mode); - - const unsigned int max_num_detection_windows = 100000; - - // Initialise descriptor (linear SVM coefficients). - // NOTE: Fixed values are used to keep the number of detection windows detected - // consistent in order to have meaningful validation tolerances. - // The values are "unbalanced" to reduce the number of detected objects - std::random_device::result_type seed = 0; - std::vector descriptor = generate_random_real(hog_info.descriptor_size(), -0.505f, 0.495f, seed); - - // Compute target and reference values using feature vector from descriptor kernel - _target = compute_target(HDF::_target, descriptor, max_num_detection_windows, hog_info, detection_window_stride); - _reference = compute_reference(HDF::_reference, descriptor, max_num_detection_windows, hog_info, detection_window_stride); - } - -protected: - std::vector compute_target(const TensorType &src, const std::vector &descriptor, unsigned int max_num_detection_windows, - const HOGInfo &hog_info, const Size2D &detection_window_stride) - { - // Create HOG - HOGType hog = create_HOG(hog_info); - - // Create array of detection windows - DetectionWindowArrayType detection_windows(max_num_detection_windows); - - // Copy HOG descriptor values to HOG memory - { - HOGAccessorType hog_accessor(hog); - std::memcpy(hog_accessor.descriptor(), descriptor.data(), descriptor.size() * sizeof(U)); - } - - // Create and configure function - HOGDetectorType hog_detector; - hog_detector.configure(&src, &hog, &detection_windows, detection_window_stride); - - // Reset detection windows - detection_windows.clear(); - - // Compute function - hog_detector.run(); - - // Create array of detection windows - std::vector windows; - - // Copy detection windows - ArrayAccessorType accessor(detection_windows); - - for(size_t i = 0; i < accessor.num_values(); i++) - { - DetectionWindow win; - win.x = accessor.at(i).x; - win.y = accessor.at(i).y; - win.width = accessor.at(i).width; - win.height = accessor.at(i).height; - win.idx_class = accessor.at(i).idx_class; - win.score = accessor.at(i).score; - - windows.push_back(win); - } - - return windows; - } - - std::vector compute_reference(const SimpleTensor &src, const std::vector &descriptor, unsigned int max_num_detection_windows, - const HOGInfo &hog_info, const Size2D &detection_window_stride) - { - // Assumes defaults value of zero for threshold and class_idx. - return reference::hog_detector(src, descriptor, max_num_detection_windows, hog_info, detection_window_stride); - } - - std::vector _target{}; - std::vector _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_HOG_DETECTOR_FIXTURE */ diff --git a/tests/validation/fixtures/HOGMultiDetectionFixture.h b/tests/validation/fixtures/HOGMultiDetectionFixture.h deleted file mode 100644 index c37bdb6df6..0000000000 --- a/tests/validation/fixtures/HOGMultiDetectionFixture.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_HOG_MULTI_DETECTION_FIXTURE -#define ARM_COMPUTE_TEST_HOG_MULTI_DETECTION_FIXTURE - -#include "arm_compute/core/HOGInfo.h" -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/IHOGAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/HOGMultiDetection.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class HOGMultiDetectionValidationFixture : public framework::Fixture -{ -public: - template - void setup(std::string image, std::vector models, Format format, BorderMode border_mode, bool non_maxima_suppression) - { - // Only defined borders supported - ARM_COMPUTE_ERROR_ON(border_mode == BorderMode::UNDEFINED); - - // Generate a random constant value - std::mt19937 gen(library->seed()); - std::uniform_int_distribution int_dist(0, 255); - const T constant_border_value = int_dist(gen); - - // Initialize descriptors vector - std::vector> descriptors(models.size()); - - // Use default values for threshold and min_distance - const float threshold = 0.f; - const float min_distance = 1.f; - - // Maximum number of detection windows per batch - const unsigned int max_num_detection_windows = 100000; - - _target = compute_target(image, format, border_mode, constant_border_value, models, descriptors, max_num_detection_windows, threshold, non_maxima_suppression, min_distance); - _reference = compute_reference(image, format, border_mode, constant_border_value, models, descriptors, max_num_detection_windows, threshold, non_maxima_suppression, min_distance); - } - -protected: - template - void fill(V &&tensor, const std::string image, Format format) - { - library->fill(tensor, image, format); - } - - void initialize_batch(const std::vector &models, MultiHOGType &multi_hog, - std::vector> &descriptors, DetectionWindowStrideType &detection_window_strides) - { - for(unsigned i = 0; i < models.size(); ++i) - { - auto hog_model = reinterpret_cast(multi_hog.model(i)); - hog_model->init(models[i]); - - // Initialise descriptor (linear SVM coefficients). - std::random_device::result_type seed = 0; - descriptors.at(i) = generate_random_real(models[i].descriptor_size(), -0.505f, 0.495f, seed); - - // Copy HOG descriptor values to HOG memory - { - HOGAccessorType hog_accessor(*hog_model); - std::memcpy(hog_accessor.descriptor(), descriptors.at(i).data(), descriptors.at(i).size() * sizeof(U)); - } - - // Initialize detection window stride - Size2DArrayAccessorType accessor(detection_window_strides); - accessor.at(i) = models[i].block_stride(); - } - } - - std::vector compute_target(const std::string image, Format &format, BorderMode &border_mode, T constant_border_value, - const std::vector &models, std::vector> &descriptors, unsigned int max_num_detection_windows, - float threshold, bool non_max_suppression, float min_distance) - { - MultiHOGType multi_hog(models.size()); - DetectionWindowArrayType detection_windows(max_num_detection_windows); - DetectionWindowStrideType detection_window_strides(models.size()); - - // Resize detection window_strides for index access - detection_window_strides.resize(models.size()); - - // Initialiize MultiHOG and detection windows - initialize_batch(models, multi_hog, descriptors, detection_window_strides); - - // Get image shape for src tensor - TensorShape shape = library->get_image_shape(image); - - // Create tensors - TensorType src = create_tensor(shape, data_type_from_format(format)); - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Create and configure function - FunctionType hog_multi_detection; - hog_multi_detection.configure(&src, &multi_hog, &detection_windows, &detection_window_strides, border_mode, constant_border_value, threshold, non_max_suppression, min_distance); - - // Reset detection windows - detection_windows.clear(); - - // Allocate tensors - src.allocator()->allocate(); - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src), image, format); - - // Compute function - hog_multi_detection.run(); - - // Copy detection windows - std::vector windows; - DetectionWindowArrayAccessorType accessor(detection_windows); - - for(size_t i = 0; i < accessor.num_values(); i++) - { - DetectionWindow win; - win.x = accessor.at(i).x; - win.y = accessor.at(i).y; - win.width = accessor.at(i).width; - win.height = accessor.at(i).height; - win.idx_class = accessor.at(i).idx_class; - win.score = accessor.at(i).score; - - windows.push_back(win); - } - - return windows; - } - - std::vector compute_reference(const std::string image, Format format, BorderMode border_mode, T constant_border_value, - const std::vector &models, const std::vector> &descriptors, unsigned int max_num_detection_windows, - float threshold, bool non_max_suppression, float min_distance) - { - // Create reference - SimpleTensor src{ library->get_image_shape(image), data_type_from_format(format) }; - - // Fill reference - fill(src, image, format); - - // NOTE: Detection window stride fixed to block stride - return reference::hog_multi_detection(src, border_mode, constant_border_value, models, descriptors, max_num_detection_windows, threshold, non_max_suppression, min_distance); - } - - std::vector _target{}; - std::vector _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_HOG_MULTI_DETECTION_FIXTURE */ diff --git a/tests/validation/fixtures/HarrisCornersFixture.h b/tests/validation/fixtures/HarrisCornersFixture.h deleted file mode 100644 index dbe77dde9c..0000000000 --- a/tests/validation/fixtures/HarrisCornersFixture.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2017-2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_HARRIS_CORNERS_FIXTURE -#define ARM_COMPUTE_TEST_HARRIS_CORNERS_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/Helpers.h" -#include "tests/validation/reference/HarrisCornerDetector.h" - -namespace arm_compute -{ -class CLHarrisCorners; -class NEHarrisCorners; - -namespace test -{ -namespace validation -{ -template -class HarrisCornersValidationFixture : public framework::Fixture -{ -public: - template - void setup(std::string image, int gradient_size, int block_size, BorderMode border_mode, Format format) - { - HarrisCornersParameters params = harris_corners_parameters(); - - _target = compute_target(image, gradient_size, block_size, border_mode, format, params); - _reference = compute_reference(image, gradient_size, block_size, border_mode, format, params); - } - -protected: - template - void fill(U &&tensor, RawTensor raw) - { - library->fill(tensor, raw); - } - - ArrayType compute_target(std::string image, int gradient_size, int block_size, BorderMode border_mode, Format format, const HarrisCornersParameters ¶ms) - { - // Load the image (cached by the library if loaded before) - const RawTensor &raw = library->get(image, format); - - // Create tensors - TensorType src = create_tensor(raw.shape(), format); - - // Create array of keypoints - ArrayType corners(raw.shape().total_size()); - - // Create harris corners configure function - FunctionType harris_corners; - harris_corners.configure(&src, params.threshold, params.min_dist, params.sensitivity, gradient_size, block_size, &corners, border_mode, params.constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src), raw); - - // Compute function - harris_corners.run(); - - return corners; - } - - std::vector compute_reference(std::string image, int gradient_size, int block_size, BorderMode border_mode, Format format, const HarrisCornersParameters ¶ms) - { - // Load the image (cached by the library if loaded before) - const RawTensor &raw = library->get(image, format); - // Create reference - SimpleTensor src{ raw.shape(), format }; - - // Fill reference - fill(src, raw); - - return reference::harris_corner_detector(src, params.threshold, params.min_dist, params.sensitivity, gradient_size, block_size, border_mode, params.constant_border_value); - } - - ArrayType _target{}; - std::vector _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_HARRIS_CORNERS_FIXTURE */ diff --git a/tests/validation/fixtures/HistogramFixture.h b/tests/validation/fixtures/HistogramFixture.h deleted file mode 100644 index dceb23b904..0000000000 --- a/tests/validation/fixtures/HistogramFixture.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_HISTOGRAM_FIXTURE -#define ARM_COMPUTE_TEST_HISTOGRAM_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Histogram.h" -#include "utils/Utils.h" - -#include - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class HistogramValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution distribution_size_t(1, 30); - const size_t num_bins = distribution_size_t(gen); - std::uniform_int_distribution distribution_int32_t(0, 125); - const size_t offset = distribution_int32_t(gen); - std::uniform_int_distribution distribution_uint32_t(1, 255 - offset); - const size_t range = distribution_uint32_t(gen); - - _target = compute_target(shape, data_type, num_bins, offset, range); - _reference = compute_reference(shape, data_type, num_bins, offset, range); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type, size_t num_bins, int32_t offset, uint32_t range) - { - // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(TensorShape(num_bins), DataType::U32); - DistributionType distribution_dst(num_bins, offset, range); - - // Create and configure function - FunctionType histogram; - histogram.configure(&src, &distribution_dst); - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - histogram.run(); - - // Copy the distribution in a tensor - arm_compute::utils::map(distribution_dst, true); - AccessorType accessor_dst = AccessorType(dst); - uint32_t *dst_data = static_cast(accessor_dst.data()); - - ARM_COMPUTE_EXPECT(accessor_dst.size() <= dst.info()->total_size(), framework::LogLevel::ERRORS); - - std::copy_n(distribution_dst.buffer(), num_bins, dst_data); - arm_compute::utils::unmap(distribution_dst); - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, size_t num_bins, int32_t offset, uint32_t range) - { - ARM_COMPUTE_ERROR_ON(data_type != DataType::U8); - - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src); - - // Compute reference - return reference::histogram(src, num_bins, offset, range); - } - - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_HISTOGRAM_FIXTURE */ diff --git a/tests/validation/fixtures/IntegralImageFixture.h b/tests/validation/fixtures/IntegralImageFixture.h deleted file mode 100644 index abc99730a9..0000000000 --- a/tests/validation/fixtures/IntegralImageFixture.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_INTEGRAL_IMAGE_FIXTURE -#define ARM_COMPUTE_TEST_INTEGRAL_IMAGE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/IntegralImage.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class IntegralImageValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type) - { - _target = compute_target(shape); - _reference = compute_reference(shape, data_type); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &shape) - { - // Create tensors - TensorType src = create_tensor(shape, DataType::U8); - TensorType dst = create_tensor(shape, DataType::U32); - - // Create and configure function - FunctionType integral_image; - integral_image.configure(&src, &dst); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - integral_image.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type) - { - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src); - - return reference::integral_image(src); - } - - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_INTEGRAL_IMAGE_FIXTURE */ diff --git a/tests/validation/fixtures/LaplacianPyramidFixture.h b/tests/validation/fixtures/LaplacianPyramidFixture.h deleted file mode 100644 index 71319965b2..0000000000 --- a/tests/validation/fixtures/LaplacianPyramidFixture.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_FIXTURE -#define ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_FIXTURE - -#include "arm_compute/core/IPyramid.h" -#include "arm_compute/core/PyramidInfo.h" -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/LaplacianPyramid.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class LaplacianPyramidValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape input_shape, BorderMode border_mode, size_t num_levels, Format format_in, Format format_out) - { - std::mt19937 generator(library->seed()); - std::uniform_int_distribution distribution_u8(0, 255); - const T constant_border_value = distribution_u8(generator); - - _pyramid_levels = num_levels; - _border_mode = border_mode; - - _target = compute_target(input_shape, border_mode, constant_border_value, format_in, format_out); - _reference = compute_reference(input_shape, border_mode, constant_border_value, format_in, format_out); - } - -protected: - template - void fill(V &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - PyramidType compute_target(const TensorShape &input_shape, BorderMode border_mode, T constant_border_value, - Format format_in, Format format_out) - { - // Create pyramid - PyramidType pyramid{}; - - // Create Pyramid Info - PyramidInfo pyramid_info(_pyramid_levels, SCALE_PYRAMID_HALF, input_shape, format_out); - - // Use conservative padding strategy to fit all subsequent kernels - pyramid.init_auto_padding(pyramid_info); - - // Create tensors - TensorType src = create_tensor(input_shape, format_in); - - // The first two dimensions of the output tensor must match the first - // two dimensions of the tensor in the last level of the pyramid - TensorShape dst_shape(input_shape); - dst_shape.set(0, pyramid.get_pyramid_level(_pyramid_levels - 1)->info()->dimension(0)); - dst_shape.set(1, pyramid.get_pyramid_level(_pyramid_levels - 1)->info()->dimension(1)); - - // The lowest resolution tensor necessary to reconstruct the input - // tensor from the pyramid. - _dst_target = create_tensor(dst_shape, format_out); - - // Create and configure function - FunctionType laplacian_pyramid; - laplacian_pyramid.configure(&src, &pyramid, &_dst_target, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(_dst_target.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - _dst_target.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!_dst_target.info()->is_resizable(), framework::LogLevel::ERRORS); - - pyramid.allocate(); - - for(size_t i = 0; i < pyramid_info.num_levels(); ++i) - { - ARM_COMPUTE_EXPECT(!pyramid.get_pyramid_level(i)->info()->is_resizable(), framework::LogLevel::ERRORS); - } - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - laplacian_pyramid.run(); - - return pyramid; - } - - std::vector> compute_reference(const TensorShape &shape, BorderMode border_mode, T constant_border_value, - Format format_in, Format format_out) - { - // Create reference - SimpleTensor src{ shape, format_in }; - - // The first two dimensions of the output tensor must match the first - // two dimensions of the tensor in the last level of the pyramid - TensorShape dst_shape(shape); - dst_shape.set(0, static_cast(shape[0] + 1) / static_cast(std::pow(2, _pyramid_levels - 1))); - dst_shape.set(1, static_cast(shape[1] + 1) / static_cast(std::pow(2, _pyramid_levels - 1))); - - _dst_reference = SimpleTensor(dst_shape, format_out); - - // Fill reference - fill(src); - - return reference::laplacian_pyramid(src, _dst_reference, _pyramid_levels, border_mode, constant_border_value); - } - - size_t _pyramid_levels{}; - BorderMode _border_mode{}; - SimpleTensor _dst_reference{}; - TensorType _dst_target{}; - PyramidType _target{}; - std::vector> _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_FIXTURE */ diff --git a/tests/validation/fixtures/LaplacianReconstructFixture.h b/tests/validation/fixtures/LaplacianReconstructFixture.h deleted file mode 100644 index 35432ee2cb..0000000000 --- a/tests/validation/fixtures/LaplacianReconstructFixture.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_FIXTURE -#define ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_FIXTURE - -#include "arm_compute/core/IPyramid.h" -#include "arm_compute/core/PyramidInfo.h" -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/fixtures/LaplacianPyramidFixture.h" -#include "tests/validation/reference/LaplacianPyramid.h" -#include "tests/validation/reference/LaplacianReconstruct.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class LaplacianReconstructValidationFixture : public LaplacianPyramidValidationFixture -{ -public: - template - void setup(TensorShape input_shape, BorderMode border_mode, size_t num_levels, Format format_in, Format format_out) - { - std::mt19937 generator(library->seed()); - std::uniform_int_distribution distribution_u8(0, 255); - const U constant_border_value = distribution_u8(generator); - - using LPF = LaplacianPyramidValidationFixture; - LPF::setup(input_shape, border_mode, num_levels, format_out, format_in); - - // Compute target and reference values using the pyramid and lowest - // resolution tensor output from Laplacian Pyramid kernel - _target = compute_target(input_shape, LPF::_target, LPF::_dst_target, border_mode, constant_border_value); - _reference = compute_reference(LPF::_reference, LPF::_dst_reference, border_mode, constant_border_value); - } - -protected: - template - void fill(V &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &input_shape, PyramidType &pyramid, TensorType &low_res, BorderMode border_mode, U constant_border_value) - { - // Create tensors - TensorType dst = create_tensor(input_shape, DataType::U8); - - // Create and configure function - FunctionType laplacian_reconstruct; - laplacian_reconstruct.configure(&pyramid, &low_res, &dst, border_mode, constant_border_value); - - // Allocate tensors - dst.allocator()->allocate(); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Compute function - laplacian_reconstruct.run(); - - return dst; - } - - SimpleTensor compute_reference(const std::vector> &pyramid, - const SimpleTensor &low_res, BorderMode border_mode, U constant_border_value) - { - return reference::laplacian_reconstruct(pyramid, low_res, border_mode, constant_border_value); - } - - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_FIXTURE */ diff --git a/tests/validation/fixtures/MagnitudeFixture.h b/tests/validation/fixtures/MagnitudeFixture.h deleted file mode 100644 index 81f4970b41..0000000000 --- a/tests/validation/fixtures/MagnitudeFixture.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2017-2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_MAGNITUDE_FIXTURE -#define ARM_COMPUTE_TEST_MAGNITUDE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Magnitude.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class MagnitudeValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, Format format, MagnitudeType magnitude_type) - { - _target = compute_target(shape, format, magnitude_type); - _reference = compute_reference(shape, format, magnitude_type); - _magnitude_type = magnitude_type; - } - -protected: - template - void fill(U &&tensor, std::random_device::result_type seed_offset) - { - library->fill_tensor_uniform(tensor, seed_offset); - } - - TensorType compute_target(const TensorShape &shape, Format format, MagnitudeType magnitude_type) - { - DataType data_type = data_type_from_format(format); - - // Create tensors - TensorType src1 = create_tensor(shape, data_type); - src1.info()->set_format(format); - - TensorType src2 = create_tensor(shape, data_type); - src2.info()->set_format(format); - - TensorType dst = create_tensor(shape, data_type); - dst.info()->set_format(format); - - // Create and configure function - FunctionType magnitude; - magnitude.configure(&src1, &src2, &dst, magnitude_type); - - ARM_COMPUTE_EXPECT(src1.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(src2.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src1.allocator()->allocate(); - src2.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src1.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!src2.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src1), 0); - fill(AccessorType(src2), 1); - - // Compute function - magnitude.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, Format format, MagnitudeType magnitude_type) - { - DataType data_type = data_type_from_format(format); - - // Create reference - SimpleTensor src1{ shape, data_type }; - SimpleTensor src2{ shape, data_type }; - - // Fill reference - fill(src1, 0); - fill(src2, 1); - - return reference::magnitude(src1, src2, magnitude_type); - } - - TensorType _target{}; - SimpleTensor _reference{}; - MagnitudeType _magnitude_type{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_MAGNITUDE_FIXTURE */ diff --git a/tests/validation/fixtures/MeanStdDevFixture.h b/tests/validation/fixtures/MeanStdDevFixture.h deleted file mode 100644 index f3facc50de..0000000000 --- a/tests/validation/fixtures/MeanStdDevFixture.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2017-2021 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_MEAN_STD_DEV_FIXTURE -#define ARM_COMPUTE_TEST_MEAN_STD_DEV_FIXTURE - -#include "tests/Globals.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/MeanStdDev.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class MeanStdDevValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type) - { - _target = compute_target(shape, data_type); - _reference = compute_reference(shape, data_type); - } - -protected: - template - void fill(U &&tensor) - { - if(tensor.data_type() == DataType::F32) - { - std::uniform_real_distribution distribution(-1.0f, 1.0f); - library->fill(tensor, distribution, 0); - } - else if(tensor.data_type() == DataType::F16) - { - arm_compute::utils::uniform_real_distribution_16bit distribution{ -1.0f, 1.0f }; - library->fill(tensor, distribution, 0); - } - else - { - library->fill_tensor_uniform(tensor, 0); - } - } - - std::pair compute_target(const TensorShape &shape, DataType data_type) - { - // Create tensors - TensorType src = create_tensor(shape, data_type); - - // Create output variables - float mean = 0.0f; - float std_dev = 0.0f; - - // Create and configure function - FunctionType mean_std_dev; - mean_std_dev.configure(&src, &mean, &std_dev); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - mean_std_dev.run(); - - return std::make_pair(mean, std_dev); - } - - std::pair compute_reference(const TensorShape &shape, DataType data_type) - { - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src); - - // Compute reference - return reference::mean_and_standard_deviation(src); - } - - std::pair _target{}; - std::pair _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_MEAN_STD_DEV_FIXTURE */ diff --git a/tests/validation/fixtures/Median3x3Fixture.h b/tests/validation/fixtures/Median3x3Fixture.h deleted file mode 100644 index 2b978005b2..0000000000 --- a/tests/validation/fixtures/Median3x3Fixture.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_MEDIAN3X3_FIXTURE -#define ARM_COMPUTE_TEST_MEDIAN3X3_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Median3x3.h" - -#include - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class Median3x3ValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type, BorderMode border_mode) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution distribution(0, 255); - const uint8_t constant_border_value = distribution(gen); - - _border_mode = border_mode; - _target = compute_target(shape, data_type, border_mode, constant_border_value); - _reference = compute_reference(shape, data_type, border_mode, constant_border_value); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type, BorderMode border_mode, uint8_t constant_border_value) - { - // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); - - // Create and configure function - FunctionType median3x3; - median3x3.configure(&src, &dst, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - median3x3.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, BorderMode border_mode, uint8_t constant_border_value) - { - ARM_COMPUTE_ERROR_ON(data_type != DataType::U8); - - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src); - - // Compute reference - return reference::median3x3(src, border_mode, constant_border_value); - } - - BorderMode _border_mode{}; - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_MEDIAN3X3_FIXTURE */ diff --git a/tests/validation/fixtures/MinMaxLocationFixture.h b/tests/validation/fixtures/MinMaxLocationFixture.h deleted file mode 100644 index 73466cce54..0000000000 --- a/tests/validation/fixtures/MinMaxLocationFixture.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_MIN_MAX_LOCATION_FIXTURE -#define ARM_COMPUTE_TEST_MIN_MAX_LOCATION_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/Types.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/MinMaxLocation.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class MinMaxLocationValidationFixture : public framework::Fixture -{ -public: - using target_type = typename std::conditional::value, int32_t, float>::type; - - template - void setup(TensorShape shape, DataType data_type) - { - _target = compute_target(shape, data_type); - _reference = compute_reference(shape, data_type); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - MinMaxLocationValues compute_target(const TensorShape &shape, DataType data_type) - { - MinMaxLocationValues target; - - ArrayType min_loc(shape.total_size()); - ArrayType max_loc(shape.total_size()); - - // Create tensors - TensorType src = create_tensor(shape, data_type); - - // Create and configure function - FunctionType min_max_loc; - min_max_loc.configure(&src, &target.min, &target.max, &min_loc, &max_loc); - - // Allocate tensors - src.allocator()->allocate(); - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - min_max_loc.run(); - - // Create accessor objects for mapping operations - ArrayAccessorType min_loc_accessor(min_loc); - ArrayAccessorType max_loc_accessor(max_loc); - - // Move min Coordinates2D values from ArrayType to vector - for(size_t i = 0; i < min_loc.num_values(); ++i) - { - target.min_loc.push_back(std::move(min_loc_accessor.at(i))); - } - - // Move max Coordinates2D values from ArrayType to vector - for(size_t i = 0; i < max_loc.num_values(); ++i) - { - target.max_loc.push_back(std::move(max_loc_accessor.at(i))); - } - - return target; - } - - MinMaxLocationValues compute_reference(const TensorShape &shape, DataType data_type) - { - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src); - - return reference::min_max_location(src); - } - - MinMaxLocationValues _target{}; - MinMaxLocationValues _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_MIN_MAX_LOCATION_FIXTURE */ diff --git a/tests/validation/fixtures/NonLinearFilterFixture.h b/tests/validation/fixtures/NonLinearFilterFixture.h deleted file mode 100644 index 03d2bcd962..0000000000 --- a/tests/validation/fixtures/NonLinearFilterFixture.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_NONLINEAR_FILTER_FIXTURE -#define ARM_COMPUTE_TEST_NONLINEAR_FILTER_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/Helpers.h" -#include "tests/validation/reference/NonLinearFilter.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class NonLinearFilterValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, NonLinearFilterFunction function, unsigned int mask_size, MatrixPattern pattern, BorderMode border_mode, DataType data_type) - { - std::mt19937 generator(library->seed()); - std::uniform_int_distribution distribution_u8(0, 255); - const uint8_t constant_border_value = distribution_u8(generator); - - // Create the mask - std::vector mask(mask_size * mask_size); - fill_mask_from_pattern(mask.data(), mask_size, mask_size, pattern); - - _border_size = BorderSize(static_cast(mask_size / 2)); - _target = compute_target(shape, data_type, function, mask_size, pattern, mask.data(), border_mode, constant_border_value); - _reference = compute_reference(shape, data_type, function, mask_size, pattern, mask.data(), border_mode, constant_border_value); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type, NonLinearFilterFunction function, unsigned int mask_size, MatrixPattern pattern, const uint8_t *mask, BorderMode border_mode, - uint8_t constant_border_value) - { - // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); - - // Create and configure function - FunctionType non_linear_filter; - non_linear_filter.configure(&src, &dst, function, mask_size, pattern, mask, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - non_linear_filter.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, NonLinearFilterFunction function, unsigned int mask_size, MatrixPattern pattern, const uint8_t *mask, - BorderMode border_mode, uint8_t constant_border_value) - { - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src); - - return reference::non_linear_filter(src, function, mask_size, pattern, mask, border_mode, constant_border_value); - } - - BorderMode _border_mode{}; - BorderSize _border_size{}; - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_NONLINEAR_FILTER_FIXTURE */ diff --git a/tests/validation/fixtures/OpticalFlowFixture.h b/tests/validation/fixtures/OpticalFlowFixture.h deleted file mode 100644 index 5c3285a601..0000000000 --- a/tests/validation/fixtures/OpticalFlowFixture.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_OPTICAL_FLOW -#define ARM_COMPUTE_TEST_OPTICAL_FLOW - -#include "arm_compute/core/PyramidInfo.h" -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/Types.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/OpticalFlow.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template - -class OpticalFlowValidationFixture : public framework::Fixture -{ -public: - template - void setup(std::string old_image_name, std::string new_image_name, OpticalFlowParameters params, - size_t num_levels, size_t num_keypoints, Format format, BorderMode border_mode) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution int_dist(0, 255); - const uint8_t constant_border_value = int_dist(gen); - - // Create keypoints - std::vector old_keypoints = generate_random_keypoints(library->get_image_shape(old_image_name), num_keypoints, library->seed(), num_levels); - std::vector new_keypoints_estimates = old_keypoints; - - _target = compute_target(old_image_name, new_image_name, params, num_levels, old_keypoints, new_keypoints_estimates, format, border_mode, constant_border_value); - _reference = compute_reference(old_image_name, new_image_name, params, num_levels, old_keypoints, new_keypoints_estimates, format, border_mode, constant_border_value); - } - -protected: - template - void fill(V &&tensor, const std::string image, Format format) - { - library->fill(tensor, image, format); - } - - ArrayType compute_target(std::string old_image_name, std::string new_image_name, OpticalFlowParameters params, size_t num_levels, - std::vector &old_keypoints, std::vector &new_keypoints_estimates, - Format format, BorderMode border_mode, uint8_t constant_border_value) - { - // Get image shapes - TensorShape old_shape = library->get_image_shape(old_image_name); - TensorShape new_shape = library->get_image_shape(new_image_name); - - // Create tensors - auto old_image = create_tensor(old_shape, format); - auto new_image = create_tensor(new_shape, format); - - // Load keypoints - ArrayType old_points(old_keypoints.size()); - ArrayType new_points_estimates(new_keypoints_estimates.size()); - ArrayType new_points(old_keypoints.size()); - - fill_array(ArrayAccessorType(old_points), old_keypoints); - fill_array(ArrayAccessorType(new_points_estimates), new_keypoints_estimates); - - // Create pyramid images - PyramidInfo pyramid_info(num_levels, SCALE_PYRAMID_HALF, old_image.info()->tensor_shape(), format); - PyramidType old_pyramid = create_pyramid(pyramid_info); - PyramidType new_pyramid = create_pyramid(pyramid_info); - - // Create and configure pyramid functions - PyramidFunctionType old_gp; - old_gp.configure(&old_image, &old_pyramid, border_mode, constant_border_value); - - PyramidFunctionType new_gp; - new_gp.configure(&new_image, &new_pyramid, border_mode, constant_border_value); - - for(size_t i = 0; i < pyramid_info.num_levels(); ++i) - { - ARM_COMPUTE_EXPECT(old_pyramid.get_pyramid_level(i)->info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(new_pyramid.get_pyramid_level(i)->info()->is_resizable(), framework::LogLevel::ERRORS); - } - - // Create and configure optical flow function - FunctionType optical_flow; - - optical_flow.configure(&old_pyramid, - &new_pyramid, - &old_points, - &new_points_estimates, - &new_points, - params.termination, - params.epsilon, - params.num_iterations, - params.window_dimension, - params.use_initial_estimate, - border_mode, - constant_border_value); - - ARM_COMPUTE_EXPECT(old_image.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(new_image.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate input tensors - old_image.allocator()->allocate(); - new_image.allocator()->allocate(); - - // Allocate pyramids - old_pyramid.allocate(); - new_pyramid.allocate(); - - ARM_COMPUTE_EXPECT(!old_image.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!new_image.info()->is_resizable(), framework::LogLevel::ERRORS); - - for(size_t i = 0; i < pyramid_info.num_levels(); ++i) - { - ARM_COMPUTE_EXPECT(!old_pyramid.get_pyramid_level(i)->info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!new_pyramid.get_pyramid_level(i)->info()->is_resizable(), framework::LogLevel::ERRORS); - } - - // Fill tensors - fill(AccessorType(old_image), old_image_name, format); - fill(AccessorType(new_image), new_image_name, format); - - // Compute functions - old_gp.run(); - new_gp.run(); - optical_flow.run(); - - return new_points; - } - - std::vector compute_reference(std::string old_image_name, std::string new_image_name, - OpticalFlowParameters params, size_t num_levels, - std::vector &old_keypoints, std::vector &new_keypoints_estimates, - Format format, BorderMode border_mode, uint8_t constant_border_value) - { - SimpleTensor old_image{ library->get_image_shape(old_image_name), data_type_from_format(format) }; - SimpleTensor new_image{ library->get_image_shape(new_image_name), data_type_from_format(format) }; - - fill(old_image, old_image_name, format); - fill(new_image, new_image_name, format); - - return reference::optical_flow(old_image, new_image, params, num_levels, old_keypoints, new_keypoints_estimates, - border_mode, constant_border_value); - } - - ArrayType _target{}; - std::vector _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_OPTICAL_FLOW */ diff --git a/tests/validation/fixtures/PhaseFixture.h b/tests/validation/fixtures/PhaseFixture.h deleted file mode 100644 index b80d1ae00e..0000000000 --- a/tests/validation/fixtures/PhaseFixture.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_PHASE_FIXTURE -#define ARM_COMPUTE_TEST_PHASE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Phase.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class PhaseValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, Format format, PhaseType phase_type) - { - _target = compute_target(shape, format, phase_type); - _reference = compute_reference(shape, format, phase_type); - } - -protected: - template - void fill(U &&tensor, std::random_device::result_type seed_offset) - { - library->fill_tensor_uniform(tensor, seed_offset); - } - - TensorType compute_target(const TensorShape &shape, Format format, PhaseType phase_type) - { - DataType data_type = data_type_from_format(format); - - // Create tensors - TensorType src1 = create_tensor(shape, data_type); - src1.info()->set_format(format); - - TensorType src2 = create_tensor(shape, data_type); - src2.info()->set_format(format); - - TensorType dst = create_tensor(shape, DataType::U8); - dst.info()->set_format(Format::U8); - - // Create and configure function - FunctionType phase; - - phase.configure(&src1, &src2, &dst, phase_type); - - ARM_COMPUTE_EXPECT(src1.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(src2.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src1.allocator()->allocate(); - src2.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src1.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!src2.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src1), 0); - fill(AccessorType(src2), 1); - - // Compute function - phase.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, Format format, PhaseType phase_type) - { - DataType data_type = data_type_from_format(format); - - // Create reference - SimpleTensor src1{ shape, data_type }; - SimpleTensor src2{ shape, data_type }; - - // Fill reference - fill(src1, 0); - fill(src2, 1); - - return reference::phase(src1, src2, phase_type); - } - - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_PHASE_FIXTURE */ diff --git a/tests/validation/fixtures/SobelFixture.h b/tests/validation/fixtures/SobelFixture.h deleted file mode 100644 index 61a6a80d70..0000000000 --- a/tests/validation/fixtures/SobelFixture.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_SOBEL_FIXTURE -#define ARM_COMPUTE_TEST_SOBEL_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Sobel.h" - -#include - -namespace arm_compute -{ -class CLSobel3x3; -class CLSobel5x5; -class CLSobel7x7; -class NESobel3x3; -class NESobel5x5; -class NESobel7x7; - -namespace test -{ -namespace validation -{ -namespace -{ -template -struct info; - -template <> -struct info -{ - static const Format dst_format = Format::S16; - static const int filter_size = 3; -}; - -template <> -struct info -{ - static const Format dst_format = Format::S16; - static const int filter_size = 3; -}; - -template <> -struct info -{ - static const Format dst_format = Format::S16; - static const int filter_size = 5; -}; - -template <> -struct info -{ - static const Format dst_format = Format::S16; - static const int filter_size = 5; -}; - -template <> -struct info -{ - static const Format dst_format = Format::S32; - static const int filter_size = 7; -}; - -template <> -struct info -{ - static const Format dst_format = Format::S32; - static const int filter_size = 7; -}; -} // namespace - -template -class SobelValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, BorderMode border_mode, Format format, GradientDimension gradient_dimension) - { - // Generate a random constant value - std::mt19937 gen(library->seed()); - std::uniform_int_distribution int_dist(0, 255); - const uint8_t constant_border_value = int_dist(gen); - - _border_mode = border_mode; - _target = compute_target(shape, border_mode, format, constant_border_value, gradient_dimension); - _reference = compute_reference(shape, info::filter_size, border_mode, format, constant_border_value, gradient_dimension); - } - -protected: - template - void fill(V &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - std::pair compute_target(const TensorShape &shape, BorderMode border_mode, Format format, uint8_t constant_border_value, GradientDimension gradient_dimension) - { - // Create tensors - TensorType src = create_tensor(shape, data_type_from_format(format)); - TensorType dst_x = create_tensor(shape, data_type_from_format(info::dst_format)); - TensorType dst_y = create_tensor(shape, data_type_from_format(info::dst_format)); - - src.info()->set_format(format); - dst_x.info()->set_format(info::dst_format); - dst_y.info()->set_format(info::dst_format); - - FunctionType sobel; - - switch(gradient_dimension) - { - case GradientDimension::GRAD_X: - sobel.configure(&src, &dst_x, nullptr, border_mode, constant_border_value); - break; - case GradientDimension::GRAD_Y: - sobel.configure(&src, nullptr, &dst_y, border_mode, constant_border_value); - break; - case GradientDimension::GRAD_XY: - sobel.configure(&src, &dst_x, &dst_y, border_mode, constant_border_value); - break; - default: - ARM_COMPUTE_ERROR("Gradient dimension not supported"); - } - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst_x.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst_y.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst_x.allocator()->allocate(); - dst_y.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst_x.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst_y.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - sobel.run(); - - return std::make_pair(std::move(dst_x), std::move(dst_y)); - } - - std::pair, SimpleTensor> compute_reference(const TensorShape &shape, int filter_size, BorderMode border_mode, Format format, uint8_t constant_border_value, - GradientDimension gradient_dimension) - { - // Create reference - SimpleTensor src{ shape, format }; - - // Fill reference - fill(src); - - return reference::sobel(src, filter_size, border_mode, constant_border_value, gradient_dimension); - } - - BorderMode _border_mode{ BorderMode::UNDEFINED }; - std::pair _target{}; - std::pair, SimpleTensor> _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_SOBEL_FIXTURE */ diff --git a/tests/validation/fixtures/TableLookupFixture.h b/tests/validation/fixtures/TableLookupFixture.h deleted file mode 100644 index a50c9fb2fe..0000000000 --- a/tests/validation/fixtures/TableLookupFixture.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2017 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_TABLE_LOOKUP_FIXTURE -#define ARM_COMPUTE_TEST_TABLE_LOOKUP_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/RawLutAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/Helpers.h" -#include "tests/validation/reference/TableLookup.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class TableLookupValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type) - { - _target = compute_target(shape, data_type); - _reference = compute_reference(shape, data_type); - } - -protected: - template - void fill(U &&tensor, int i) - { - library->fill_tensor_uniform(tensor, i); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type) - { - // Create Lut - const int num_elem = (data_type == DataType::U8) ? std::numeric_limits::max() + 1 : std::numeric_limits::max() - std::numeric_limits::lowest() + 1; - LutType lut(num_elem, data_type); - - //Fill the Lut - fill_lookuptable(LutAccessorType(lut)); - - // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); - - // Create and configure function - FunctionType table_lookup; - table_lookup.configure(&src, &lut, &dst); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src), 0); - fill(AccessorType(dst), 1); - - // Compute function - table_lookup.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type) - { - // Create rawLut - std::map rawlut; - - // Fill the Lut - fill_lookuptable(RawLutAccessor(rawlut)); - - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src, 0); - - return reference::table_lookup(src, rawlut); - } - - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_TABLE_LOOKUP_FIXTURE */ diff --git a/tests/validation/fixtures/ThresholdFixture.h b/tests/validation/fixtures/ThresholdFixture.h deleted file mode 100644 index 038c296178..0000000000 --- a/tests/validation/fixtures/ThresholdFixture.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_THRESHOLD_FIXTURE -#define ARM_COMPUTE_TEST_THRESHOLD_FIXTURE - -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Threshold.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class ThresholdValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, uint8_t threshold, uint8_t false_value, uint8_t true_value, ThresholdType type, uint8_t upper, DataType data_type) - { - _target = compute_target(shape, data_type, threshold, false_value, true_value, type, upper); - _reference = compute_reference(shape, data_type, threshold, false_value, true_value, type, upper); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type, - uint8_t threshold, uint8_t false_value, uint8_t true_value, - ThresholdType type, uint8_t upper) - { - // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); - - // Create and configure function - FunctionType thrsh; - thrsh.configure(&src, &dst, ThresholdKernelInfo(threshold, false_value, true_value, type, upper)); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - thrsh.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, - uint8_t threshold, uint8_t false_value, uint8_t true_value, - ThresholdType type, uint8_t upper) - { - // Create reference - SimpleTensor src{ shape, data_type }; - - // Fill reference - fill(src); - - return reference::threshold(src, threshold, false_value, true_value, type, upper); - } - - TensorType _target{}; - SimpleTensor _reference{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_THRESHOLD_FIXTURE */ diff --git a/tests/validation/fixtures/WarpAffineFixture.h b/tests/validation/fixtures/WarpAffineFixture.h deleted file mode 100644 index 014d6628b1..0000000000 --- a/tests/validation/fixtures/WarpAffineFixture.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2017-2018 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_WARP_AFFINE_FIXTURE -#define ARM_COMPUTE_TEST_WARP_AFFINE_FIXTURE - -#include - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Utils.h" -#include "tests/validation/reference/WarpAffine.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class WarpAffineValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape shape, DataType data_type, InterpolationPolicy policy, BorderMode border_mode) - { - // Generate a random constant value if border_mode is constant - std::mt19937 gen(library->seed()); - std::uniform_int_distribution distribution_u8(0, 255); - uint8_t constant_border_value = distribution_u8(gen); - - // Create the matrix - std::array matrix{ {} }; - fill_warp_matrix<9>(matrix); - - _target = compute_target(shape, data_type, matrix, policy, border_mode, constant_border_value); - _reference = compute_reference(shape, data_type, matrix, policy, border_mode, constant_border_value); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &shape, DataType data_type, const std::array &matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value) - { - // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); - - // Create and configure function - FunctionType warp_affine; - warp_affine.configure(&src, &dst, matrix, policy, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - warp_affine.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, const std::array &matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value) - { - // Create reference - SimpleTensor src{ shape, data_type }; - - // Create the valid mask Tensor - _valid_mask = SimpleTensor(shape, data_type); - - // Fill reference - fill(src); - - return reference::warp_affine(src, _valid_mask, matrix.data(), policy, border_mode, constant_border_value); - } - - TensorType _target{}; - SimpleTensor _reference{}; - SimpleTensor _valid_mask{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_WARP_AFFINE_FIXTURE */ diff --git a/tests/validation/fixtures/WarpPerspectiveFixture.h b/tests/validation/fixtures/WarpPerspectiveFixture.h deleted file mode 100644 index 40ae3b956c..0000000000 --- a/tests/validation/fixtures/WarpPerspectiveFixture.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2017-2019 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_WARP_PERSPECTIVE_FIXTURE -#define ARM_COMPUTE_TEST_WARP_PERSPECTIVE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Utils.h" -#include "tests/validation/reference/WarpPerspective.h" - -#include - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template -class WarpPerspectiveValidationFixture : public framework::Fixture -{ -public: - template - void setup(TensorShape input_shape, DataType data_type, InterpolationPolicy policy, BorderMode border_mode) - { - uint8_t constant_border_value = 0; - // Generate a random constant value if border_mode is constant - if(border_mode == BorderMode::CONSTANT) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution distribution_u8(0, 255); - constant_border_value = distribution_u8(gen); - } - - // Create the matrix - std::array matrix = { { 0 } }; - fill_warp_matrix<9>(matrix); - - _target = compute_target(input_shape, matrix, policy, border_mode, constant_border_value, data_type); - _reference = compute_reference(input_shape, matrix, policy, border_mode, constant_border_value, data_type); - } - -protected: - template - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &shape, const std::array &matrix, InterpolationPolicy policy, BorderMode border_mode, - uint8_t constant_border_value, - DataType data_type) - { - // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); - - // Create and configure function - FunctionType warp_perspective; - warp_perspective.configure(&src, &dst, matrix, policy, border_mode, constant_border_value); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - warp_perspective.run(); - - return dst; - } - - SimpleTensor compute_reference(const TensorShape &shape, const std::array &matrix, InterpolationPolicy policy, BorderMode border_mode, - uint8_t constant_border_value, - DataType data_type) - { - ARM_COMPUTE_ERROR_ON(data_type != DataType::U8); - - // Create reference - SimpleTensor src{ shape, data_type }; - - // Create the valid mask Tensor - _valid_mask = SimpleTensor(shape, data_type); - - // Fill reference - fill(src); - - // Compute reference - return reference::warp_perspective(src, _valid_mask, matrix.data(), policy, border_mode, constant_border_value); - } - - TensorType _target{}; - SimpleTensor _reference{}; - BorderMode _border_mode{}; - SimpleTensor _valid_mask{}; -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_WARP_PERSPECTIVE_FIXTURE */ diff --git a/tests/validation/reference/Convolution.cpp b/tests/validation/reference/Convolution.cpp deleted file mode 100644 index 0a4e04392e..0000000000 --- a/tests/validation/reference/Convolution.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/core/Helpers.h" - -#include "Convolution.h" -#include "Utils.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace reference -{ -template -SimpleTensor convolution(const SimpleTensor &src, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value, - const unsigned int width, - const unsigned int height) -{ - ARM_COMPUTE_ERROR_ON(scale == 0); - ARM_COMPUTE_ERROR_ON(scale >= static_cast(std::numeric_limits::max())); - - SimpleTensor dst(src.shape(), output_data_type); - SimpleTensor sum(src.shape(), output_data_type); - const uint32_t num_elements = src.num_elements(); -#if defined(_OPENMP) - #pragma omp parallel for -#endif /* _OPENMP */ - for(uint32_t element_idx = 0; element_idx < num_elements; ++element_idx) - { - const Coordinates id = index2coord(src.shape(), element_idx); - apply_2d_spatial_filter(id, src, sum, TensorShape(width, height), conv, 1, border_mode, constant_border_value); - dst[element_idx] = saturate_cast(tensor_elem_at(sum, id, border_mode, constant_border_value) / static_cast(scale)); - } - - return dst; -} - -template SimpleTensor convolution(const SimpleTensor &src, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value, - const unsigned int widht, const unsigned int height); -template SimpleTensor convolution(const SimpleTensor &src, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value, - const unsigned int widht, const unsigned int height); -} // namespace reference -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation/reference/Convolution.h b/tests/validation/reference/Convolution.h deleted file mode 100644 index 174ce7e2ef..0000000000 --- a/tests/validation/reference/Convolution.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017-2019 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_CONVOLUTION_H -#define ARM_COMPUTE_TEST_CONVOLUTION_H - -#include "tests/SimpleTensor.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace reference -{ -template -SimpleTensor convolution(const SimpleTensor &src, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value, - const unsigned int width, - const unsigned int height); -} // namespace reference -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_CONVOLUTION_H */ -- cgit v1.2.1