From a09de0c8b2ed0f1481502d3b023375609362d9e3 Mon Sep 17 00:00:00 2001 From: Moritz Pflanzer Date: Fri, 1 Sep 2017 20:41:12 +0100 Subject: COMPMID-415: Rename and move tests The boost validation is now "standalone" in validation_old and builds as arm_compute_validation_old. The new validation builds now as arm_compute_validation. Change-Id: Ib93ba848a25680ac60afb92b461d574a0757150d Reviewed-on: http://mpd-gerrit.cambridge.arm.com/86187 Tested-by: Kaizen Reviewed-by: Anthony Barbier --- tests/validation_new/CL/ActivationLayer.cpp | 247 --------------------- tests/validation_new/CL/BitwiseAnd.cpp | 94 -------- tests/validation_new/CL/BitwiseNot.cpp | 90 -------- tests/validation_new/CL/BitwiseOr.cpp | 94 -------- tests/validation_new/CL/BitwiseXor.cpp | 94 -------- tests/validation_new/CL/ConvolutionLayer.cpp | 186 ---------------- tests/validation_new/CL/DepthConcatenateLayer.cpp | 123 ---------- tests/validation_new/CL/DepthwiseConvolution.cpp | 69 ------ .../CL/DepthwiseSeparableConvolutionLayer.cpp | 64 ------ tests/validation_new/CL/DirectConvolutionLayer.cpp | 129 ----------- tests/validation_new/CL/Floor.cpp | 66 ------ tests/validation_new/CL/FullyConnectedLayer.cpp | 195 ---------------- tests/validation_new/CL/GEMM.cpp | 167 -------------- tests/validation_new/CL/L2Normalize.cpp | 78 ------- tests/validation_new/CL/MeanStdDev.cpp | 97 -------- tests/validation_new/CL/NormalizationLayer.cpp | 141 ------------ tests/validation_new/CL/PoolingLayer.cpp | 142 ------------ tests/validation_new/CL/ReductionOperation.cpp | 78 ------- tests/validation_new/CL/Scale.cpp | 129 ----------- tests/validation_new/CL/SoftmaxLayer.cpp | 168 -------------- 20 files changed, 2451 deletions(-) delete mode 100644 tests/validation_new/CL/ActivationLayer.cpp delete mode 100644 tests/validation_new/CL/BitwiseAnd.cpp delete mode 100644 tests/validation_new/CL/BitwiseNot.cpp delete mode 100644 tests/validation_new/CL/BitwiseOr.cpp delete mode 100644 tests/validation_new/CL/BitwiseXor.cpp delete mode 100644 tests/validation_new/CL/ConvolutionLayer.cpp delete mode 100644 tests/validation_new/CL/DepthConcatenateLayer.cpp delete mode 100644 tests/validation_new/CL/DepthwiseConvolution.cpp delete mode 100644 tests/validation_new/CL/DepthwiseSeparableConvolutionLayer.cpp delete mode 100644 tests/validation_new/CL/DirectConvolutionLayer.cpp delete mode 100644 tests/validation_new/CL/Floor.cpp delete mode 100644 tests/validation_new/CL/FullyConnectedLayer.cpp delete mode 100644 tests/validation_new/CL/GEMM.cpp delete mode 100644 tests/validation_new/CL/L2Normalize.cpp delete mode 100644 tests/validation_new/CL/MeanStdDev.cpp delete mode 100644 tests/validation_new/CL/NormalizationLayer.cpp delete mode 100644 tests/validation_new/CL/PoolingLayer.cpp delete mode 100644 tests/validation_new/CL/ReductionOperation.cpp delete mode 100644 tests/validation_new/CL/Scale.cpp delete mode 100644 tests/validation_new/CL/SoftmaxLayer.cpp (limited to 'tests/validation_new/CL') diff --git a/tests/validation_new/CL/ActivationLayer.cpp b/tests/validation_new/CL/ActivationLayer.cpp deleted file mode 100644 index c8fddc7db6..0000000000 --- a/tests/validation_new/CL/ActivationLayer.cpp +++ /dev/null @@ -1,247 +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. - */ -#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/CLActivationLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ActivationFunctionsDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/ActivationLayerFixture.h" -#include "tests/validation_new/half.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/** Define tolerance of the activation layer. - * - * @param[in] activation The activation function used. - * @param[in] data_type Data type. - * - * @return Tolerance depending on the activation function. - */ -AbsoluteTolerance tolerance(ActivationLayerInfo::ActivationFunction activation, DataType data_type) -{ - constexpr float epsilon = 1e-6f; - - switch(activation) - { - case ActivationLayerInfo::ActivationFunction::LINEAR: - return AbsoluteTolerance(data_type == DataType::F16 ? 0.2f : epsilon); - case ActivationLayerInfo::ActivationFunction::SQUARE: - return AbsoluteTolerance(data_type == DataType::F16 ? 0.1f : epsilon); - case ActivationLayerInfo::ActivationFunction::LOGISTIC: - if(is_data_type_fixed_point(data_type)) - { - return AbsoluteTolerance(5.f); - } - else - { - return AbsoluteTolerance(data_type == DataType::F16 ? 0.001f : epsilon); - } - case ActivationLayerInfo::ActivationFunction::LEAKY_RELU: - return AbsoluteTolerance(data_type == DataType::F16 ? 0.00001f : epsilon); - case ActivationLayerInfo::ActivationFunction::SOFT_RELU: - case ActivationLayerInfo::ActivationFunction::SQRT: - if(is_data_type_fixed_point(data_type)) - { - return AbsoluteTolerance(5.f); - } - else - { - return AbsoluteTolerance(data_type == DataType::F16 ? 0.01f : 0.00001f); - } - case ActivationLayerInfo::ActivationFunction::TANH: - if(is_data_type_fixed_point(data_type)) - { - return AbsoluteTolerance(5.f); - } - else - { - return AbsoluteTolerance(data_type == DataType::F16 ? 0.001f : 0.00001f); - } - default: - return AbsoluteTolerance(epsilon); - } -} - -/** CNN data types */ -const auto CNNDataTypes = framework::dataset::make("DataType", -{ - DataType::F16, - DataType::F32, - DataType::QS8, - DataType::QS16, -}); - -/** Input data sets. */ -const auto ActivationDataset = combine(combine(framework::dataset::make("InPlace", { false, true }), datasets::ActivationFunctions()), framework::dataset::make("AlphaBeta", { 0.5f, 1.f })); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(ActivationLayer) - -DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), CNNDataTypes), framework::dataset::make("InPlace", { false, true })), - shape, data_type, in_place) -{ - // Set fixed point position data type allowed - const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0; - - // Create tensors - CLTensor src = create_tensor(shape, data_type, 1, fixed_point_position); - CLTensor dst = create_tensor(shape, data_type, 1, fixed_point_position); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Create and configure function - CLActivationLayer act_layer; - - if(in_place) - { - act_layer.configure(&src, nullptr, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::ABS)); - } - else - { - act_layer.configure(&src, &dst, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::ABS)); - } - - // Validate valid region - const ValidRegion valid_region = shape_to_valid_region(shape); - validate(src.info()->valid_region(), valid_region); - - if(!in_place) - { - validate(dst.info()->valid_region(), valid_region); - } - - // Validate padding - const int step = 16 / arm_compute::data_size_from_type(data_type); - const PaddingSize padding = PaddingCalculator(shape.x(), step).required_padding(); - validate(src.info()->padding(), padding); - - if(!in_place) - { - validate(dst.info()->padding(), padding); - } -} - -template -using CLActivationLayerFixture = ActivationValidationFixture; - -TEST_SUITE(Float) -TEST_SUITE(FP16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLActivationLayerFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), ActivationDataset), - framework::dataset::make("DataType", - DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance(_function, _data_type)); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLActivationLayerFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), ActivationDataset), - framework::dataset::make("DataType", - DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance(_function, _data_type)); -} -TEST_SUITE_END() - -TEST_SUITE(FP32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLActivationLayerFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), ActivationDataset), framework::dataset::make("DataType", - DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance(_function, _data_type)); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLActivationLayerFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), ActivationDataset), framework::dataset::make("DataType", - DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance(_function, _data_type)); -} -TEST_SUITE_END() -TEST_SUITE_END() - -template -using CLActivationLayerFixedPointFixture = ActivationValidationFixedPointFixture; - -TEST_SUITE(Quantized) -TEST_SUITE(QS8) -// We test for fixed point precision [3,5] because [1,2] and [6,7] ranges cause -// overflowing issues in most of the transcendentals functions. -FIXTURE_DATA_TEST_CASE(RunSmall, CLActivationLayerFixedPointFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), ActivationDataset), - framework::dataset::make("DataType", - DataType::QS8)), - framework::dataset::make("FractionalBits", 3, 6))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance(_function, _data_type)); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLActivationLayerFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), ActivationDataset), - framework::dataset::make("DataType", - DataType::QS8)), - framework::dataset::make("FractionalBits", 3, 6))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance(_function, _data_type)); -} -TEST_SUITE_END() - -TEST_SUITE(QS16) -// Testing for fixed point position [1,14) as reciprocal limits the maximum fixed point position to 14 -FIXTURE_DATA_TEST_CASE(RunSmall, CLActivationLayerFixedPointFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), ActivationDataset), - framework::dataset::make("DataType", - DataType::QS16)), - framework::dataset::make("FractionalBits", 1, 14))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance(_function, _data_type)); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLActivationLayerFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), ActivationDataset), - framework::dataset::make("DataType", - DataType::QS16)), - framework::dataset::make("FractionalBits", 1, 14))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance(_function, _data_type)); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/BitwiseAnd.cpp b/tests/validation_new/CL/BitwiseAnd.cpp deleted file mode 100644 index af40812b2a..0000000000 --- a/tests/validation_new/CL/BitwiseAnd.cpp +++ /dev/null @@ -1,94 +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. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLBitwiseAnd.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/BitwiseAndFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(BitwiseAnd) - -DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", DataType::U8)), shape, data_type) -{ - // Create tensors - CLTensor src1 = create_tensor(shape, data_type); - CLTensor src2 = create_tensor(shape, data_type); - CLTensor dst = create_tensor(shape, data_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); - - // Create and configure function - CLBitwiseAnd bitwise_and; - bitwise_and.configure(&src1, &src2, &dst); - - // Validate valid region - const ValidRegion valid_region = shape_to_valid_region(shape); - validate(src1.info()->valid_region(), valid_region); - validate(src2.info()->valid_region(), valid_region); - validate(dst.info()->valid_region(), valid_region); - - // Validate padding - const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding(); - validate(src1.info()->padding(), padding); - validate(src2.info()->padding(), padding); - validate(dst.info()->padding(), padding); -} - -template -using CLBitwiseAndFixture = BitwiseAndValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLBitwiseAndFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLBitwiseAndFixture, 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_new/CL/BitwiseNot.cpp b/tests/validation_new/CL/BitwiseNot.cpp deleted file mode 100644 index e95619f481..0000000000 --- a/tests/validation_new/CL/BitwiseNot.cpp +++ /dev/null @@ -1,90 +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. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLBitwiseNot.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/BitwiseNotFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(BitwiseNot) - -DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", DataType::U8)), shape, data_type) -{ - // Create tensors - CLTensor src = create_tensor(shape, data_type); - CLTensor dst = create_tensor(shape, data_type); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Create and configure function - CLBitwiseNot bitwise_not; - bitwise_not.configure(&src, &dst); - - // Validate valid region - const ValidRegion valid_region = shape_to_valid_region(shape); - validate(src.info()->valid_region(), valid_region); - validate(dst.info()->valid_region(), valid_region); - - // Validate padding - const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding(); - validate(src.info()->padding(), padding); - validate(dst.info()->padding(), padding); -} - -template -using CLBitwiseNotFixture = BitwiseNotValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLBitwiseNotFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLBitwiseNotFixture, 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_new/CL/BitwiseOr.cpp b/tests/validation_new/CL/BitwiseOr.cpp deleted file mode 100644 index 15964eecc3..0000000000 --- a/tests/validation_new/CL/BitwiseOr.cpp +++ /dev/null @@ -1,94 +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. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLBitwiseOr.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/BitwiseOrFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(BitwiseOr) - -DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", DataType::U8)), shape, data_type) -{ - // Create tensors - CLTensor src1 = create_tensor(shape, data_type); - CLTensor src2 = create_tensor(shape, data_type); - CLTensor dst = create_tensor(shape, data_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); - - // Create and configure function - CLBitwiseOr bitwise_or; - bitwise_or.configure(&src1, &src2, &dst); - - // Validate valid region - const ValidRegion valid_region = shape_to_valid_region(shape); - validate(src1.info()->valid_region(), valid_region); - validate(src2.info()->valid_region(), valid_region); - validate(dst.info()->valid_region(), valid_region); - - // Validate padding - const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding(); - validate(src1.info()->padding(), padding); - validate(src2.info()->padding(), padding); - validate(dst.info()->padding(), padding); -} - -template -using CLBitwiseOrFixture = BitwiseOrValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLBitwiseOrFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLBitwiseOrFixture, 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_new/CL/BitwiseXor.cpp b/tests/validation_new/CL/BitwiseXor.cpp deleted file mode 100644 index 8e8852209b..0000000000 --- a/tests/validation_new/CL/BitwiseXor.cpp +++ /dev/null @@ -1,94 +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. - */ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLBitwiseXor.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/BitwiseXorFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(BitwiseXor) - -DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", DataType::U8)), shape, data_type) -{ - // Create tensors - CLTensor src1 = create_tensor(shape, data_type); - CLTensor src2 = create_tensor(shape, data_type); - CLTensor dst = create_tensor(shape, data_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); - - // Create and configure function - CLBitwiseXor bitwise_xor; - bitwise_xor.configure(&src1, &src2, &dst); - - // Validate valid region - const ValidRegion valid_region = shape_to_valid_region(shape); - validate(src1.info()->valid_region(), valid_region); - validate(src2.info()->valid_region(), valid_region); - validate(dst.info()->valid_region(), valid_region); - - // Validate padding - const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding(); - validate(src1.info()->padding(), padding); - validate(src2.info()->padding(), padding); - validate(dst.info()->padding(), padding); -} - -template -using CLBitwiseXorFixture = BitwiseXorValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLBitwiseXorFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::U8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLBitwiseXorFixture, 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_new/CL/ConvolutionLayer.cpp b/tests/validation_new/CL/ConvolutionLayer.cpp deleted file mode 100644 index 9703e0bcba..0000000000 --- a/tests/validation_new/CL/ConvolutionLayer.cpp +++ /dev/null @@ -1,186 +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 CONCLCTION 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/CLConvolutionLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/LargeConvolutionLayerDataset.h" -#include "tests/datasets_new/SmallConvolutionLayerDataset.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/ConvolutionLayerFixture.h" -#include "tests/validation_new/half.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr AbsoluteTolerance tolerance_f32(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */ -constexpr AbsoluteTolerance tolerance_f16(0.1f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */ -constexpr AbsoluteTolerance tolerance_q(1.0f); /**< Tolerance value for comparing reference's output against implementation's output for fixed point data types */ - -/** CNN data types */ -const auto CNNDataTypes = framework::dataset::make("DataType", -{ - DataType::F16, - DataType::F32, - DataType::QS8, - DataType::QS16, -}); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(ConvolutionLayer) - -DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::SmallConvolutionLayerDataset(), datasets::LargeConvolutionLayerDataset()), CNNDataTypes), - input_shape, weights_shape, bias_shape, output_shape, info, data_type) -{ - // Set fixed point position data type allowed - int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0; - - // Create tensors - CLTensor src = create_tensor(input_shape, data_type, 1, fixed_point_position); - CLTensor weights = create_tensor(weights_shape, data_type, 1, fixed_point_position); - CLTensor bias = create_tensor(bias_shape, data_type, 1, fixed_point_position); - CLTensor dst = create_tensor(output_shape, data_type, 1, fixed_point_position); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Create and configure function - CLConvolutionLayer conv; - conv.configure(&src, &weights, &bias, &dst, info); - - // Validate valid region - const ValidRegion src_valid_region = shape_to_valid_region(input_shape); - const ValidRegion weights_valid_region = shape_to_valid_region(weights_shape); - const ValidRegion bias_valid_region = shape_to_valid_region(bias_shape); - const ValidRegion dst_valid_region = shape_to_valid_region(output_shape); - - validate(src.info()->valid_region(), src_valid_region); - validate(weights.info()->valid_region(), weights_valid_region); - validate(bias.info()->valid_region(), bias_valid_region); - validate(dst.info()->valid_region(), dst_valid_region); - - // Validate padding - //TODO(COMPMID-415) Need to validate padding? -} - -template -using CLConvolutionLayerFixture = ConvolutionValidationFixture; - -TEST_SUITE(Float) -TEST_SUITE(FP16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLConvolutionLayerFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallConvolutionLayerDataset(), - framework::dataset::make("DataType", - DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f16); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeConvolutionLayerDataset(), - framework::dataset::make("DataType", - DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f16); -} -TEST_SUITE_END() - -TEST_SUITE(FP32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLConvolutionLayerFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallConvolutionLayerDataset(), framework::dataset::make("DataType", - DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeConvolutionLayerDataset(), framework::dataset::make("DataType", - DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -TEST_SUITE_END() -TEST_SUITE_END() - -template -using CLConvolutionLayerFixedPointFixture = ConvolutionValidationFixedPointFixture; - -TEST_SUITE(Quantized) -TEST_SUITE(QS8) -// We test for fixed point precision [4,6] -FIXTURE_DATA_TEST_CASE(RunSmall, CLConvolutionLayerFixedPointFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallConvolutionLayerDataset(), - framework::dataset::make("DataType", - DataType::QS8)), - framework::dataset::make("FractionalBits", 4, 7))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_q); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionLayerFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeConvolutionLayerDataset(), - framework::dataset::make("DataType", - DataType::QS8)), - framework::dataset::make("FractionalBits", 4, 7))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_q); -} -TEST_SUITE_END() - -TEST_SUITE(QS16) -// Testing for fixed point position [1,14) -FIXTURE_DATA_TEST_CASE(RunSmall, CLConvolutionLayerFixedPointFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallConvolutionLayerDataset(), - framework::dataset::make("DataType", - DataType::QS16)), - framework::dataset::make("FractionalBits", 1, 14))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_q); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLConvolutionLayerFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeConvolutionLayerDataset(), - framework::dataset::make("DataType", - DataType::QS16)), - framework::dataset::make("FractionalBits", 1, 14))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_q); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/DepthConcatenateLayer.cpp b/tests/validation_new/CL/DepthConcatenateLayer.cpp deleted file mode 100644 index ff64e2340b..0000000000 --- a/tests/validation_new/CL/DepthConcatenateLayer.cpp +++ /dev/null @@ -1,123 +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. - */ -#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/CLDepthConcatenate.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/DepthConcatenateLayerFixture.h" -#include "tests/validation_new/half.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(DepthConcatenateLayer) - -//TODO(COMPMID-415): Add configuration test? - -template -using CLDepthConcatenateLayerFixture = DepthConcatenateValidationFixture; - -TEST_SUITE(Float) -TEST_SUITE(FP16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthConcatenateLayerFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", - DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthConcatenateLayerFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("DataType", - DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -TEST_SUITE_END() - -TEST_SUITE(FP32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthConcatenateLayerFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", - DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthConcatenateLayerFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("DataType", - DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE(Quantized) -TEST_SUITE(QS8) -FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthConcatenateLayerFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), - framework::dataset::make("DataType", - DataType::QS8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthConcatenateLayerFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), - framework::dataset::make("DataType", - DataType::QS8))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -TEST_SUITE_END() - -TEST_SUITE(QS16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthConcatenateLayerFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), - framework::dataset::make("DataType", - DataType::QS16))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthConcatenateLayerFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), - framework::dataset::make("DataType", - DataType::QS16))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/DepthwiseConvolution.cpp b/tests/validation_new/CL/DepthwiseConvolution.cpp deleted file mode 100644 index 3fda275715..0000000000 --- a/tests/validation_new/CL/DepthwiseConvolution.cpp +++ /dev/null @@ -1,69 +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 CONCLCTION 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/CLDepthwiseConvolution.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/LargeDepthwiseConvolutionDataset.h" -#include "tests/datasets_new/SmallDepthwiseConvolutionDataset.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/DepthwiseConvolutionFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr AbsoluteTolerance tolerance_f32(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */ -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(DepthwiseConvolution) - -template -using CLDepthwiseConvolutionFixture = DepthwiseConvolutionValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionFixture, framework::DatasetMode::PRECOMMIT, datasets::SmallDepthwiseConvolutionDataset()) -{ - validate(CLAccessor(_target), _reference, tolerance_f32); -} - -FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionFixture, framework::DatasetMode::NIGHTLY, datasets::LargeDepthwiseConvolutionDataset()) -{ - validate(CLAccessor(_target), _reference, tolerance_f32); -} - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/DepthwiseSeparableConvolutionLayer.cpp b/tests/validation_new/CL/DepthwiseSeparableConvolutionLayer.cpp deleted file mode 100644 index e577f5af04..0000000000 --- a/tests/validation_new/CL/DepthwiseSeparableConvolutionLayer.cpp +++ /dev/null @@ -1,64 +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 CONCLCTION 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/CLDepthwiseSeparableConvolutionLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/MobileNetDepthwiseSeparableConvolutionLayerDataset.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/DepthwiseSeparableConvolutionLayerFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr AbsoluteTolerance tolerance_f32(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */ -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(DepthwiseSeparableConvolutionLayer) - -// Configuration test to do - -template -using CLDepthwiseSeparableConvolutionLayerFixture = DepthwiseSeparableConvolutionValidationFixture; -FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseSeparableConvolutionLayerFixture, framework::DatasetMode::PRECOMMIT, datasets::MobileNetDepthwiseSeparableConvolutionLayerDataset()) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/DirectConvolutionLayer.cpp b/tests/validation_new/CL/DirectConvolutionLayer.cpp deleted file mode 100644 index 1c698ace0f..0000000000 --- a/tests/validation_new/CL/DirectConvolutionLayer.cpp +++ /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. - */ -#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/CLDirectConvolutionLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/DirectConvolutionLayerFixture.h" -#include "tests/validation_new/half.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr AbsoluteTolerance tolerance_fp16(0.1f); /**< Tolerance for floating point tests */ -constexpr AbsoluteTolerance tolerance_fp32(0.001f); /**< Tolerance for floating point tests */ - -constexpr AbsoluteTolerance tolerance_qs8(0); /**< Tolerance for fixed point tests */ -constexpr AbsoluteTolerance tolerance_qs16(0); /**< Tolerance for fixed point tests */ - -/** Direct convolution data set. */ -const auto data_quantized = combine(datasets::SmallDirectConvolutionShapes(), - combine(framework::dataset::make("StrideX", 1, 3), - combine(framework::dataset::make("StrideY", 1, 3), - combine(concat(combine(framework::dataset::make("PadX", 0), - combine(framework::dataset::make("PadY", 0), - framework::dataset::make("KernelSize", 1))), - combine(framework::dataset::make("PadX", 0, 2), - combine(framework::dataset::make("PadY", 0, 2), - framework::dataset::make("KernelSize", { 3 })))), - framework::dataset::make("NumKernels", { 1, 4, 8, 16 }))))); - -const auto data = combine(datasets::SmallDirectConvolutionShapes(), - combine(framework::dataset::make("StrideX", 1, 3), - combine(framework::dataset::make("StrideY", 1, 3), - combine(concat(combine(framework::dataset::make("PadX", 0), - combine(framework::dataset::make("PadY", 0), - framework::dataset::make("KernelSize", 1))), - combine(framework::dataset::make("PadX", 0, 2), - combine(framework::dataset::make("PadY", 0, 2), - framework::dataset::make("KernelSize", { 3, 5 })))), - framework::dataset::make("NumKernels", { 1, 4, 8, 16 }))))); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(DirectConvolutionLayer) - -//TODO(COMPMID-415): Configuration tests? - -template -using CLDirectConvolutionLayerFixture = DirectConvolutionValidationFixture; - -TEST_SUITE(Float) -TEST_SUITE(FP16) -FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionLayerFixture, framework::DatasetMode::ALL, combine(data, framework::dataset::make("DataType", DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_fp16); -} -TEST_SUITE_END() - -TEST_SUITE(FP32) -FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionLayerFixture, framework::DatasetMode::ALL, combine(data, framework::dataset::make("DataType", DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_fp32); -} -TEST_SUITE_END() -TEST_SUITE_END() - -template -using CLDirectConvolutionLayerFixedPointFixture = DirectConvolutionValidationFixedPointFixture; - -TEST_SUITE(Quantized) -TEST_SUITE(QS8) -FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionLayerFixedPointFixture, framework::DatasetMode::ALL, combine(combine(data_quantized, framework::dataset::make("DataType", DataType::QS8)), - framework::dataset::make("FractionalBits", 2, 7))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_qs8); -} -TEST_SUITE_END() - -TEST_SUITE(QS16) -FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionLayerFixedPointFixture, framework::DatasetMode::ALL, combine(combine(data_quantized, framework::dataset::make("DataType", DataType::QS16)), - framework::dataset::make("FractionalBits", 2, 15))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_qs16); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/Floor.cpp b/tests/validation_new/CL/Floor.cpp deleted file mode 100644 index 461a914be9..0000000000 --- a/tests/validation_new/CL/Floor.cpp +++ /dev/null @@ -1,66 +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. - */ -#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/CLFloor.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/FloorFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -TEST_SUITE(CL) -TEST_SUITE(Floor) - -template -using CLFloorFixture = FloorValidationFixture; - -TEST_SUITE(FP32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLFloorFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLFloorFixture, framework::DatasetMode::NIGHTLY, combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32))) -{ - // 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_new/CL/FullyConnectedLayer.cpp b/tests/validation_new/CL/FullyConnectedLayer.cpp deleted file mode 100644 index e43997c47b..0000000000 --- a/tests/validation_new/CL/FullyConnectedLayer.cpp +++ /dev/null @@ -1,195 +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. - */ -#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/CLFullyConnectedLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/FullyConnectedLayerDataset.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/FullyConnectedLayerFixture.h" -#include "tests/validation_new/half.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/** Tolerance for float operations */ -constexpr AbsoluteTolerance tolerance_f32(0.001f); -constexpr AbsoluteTolerance tolerance_f16(0.4f); -/** Tolerance for fixed point operations */ -constexpr AbsoluteTolerance tolerance_fixed_point(1.f); - -/** CNN data types */ -const auto CNNDataTypes = framework::dataset::make("DataType", -{ - DataType::F16, - DataType::F32, - DataType::QS8, - DataType::QS16, -}); - -const auto FullyConnectedParameters = combine(framework::dataset::make("TransposeWeights", { false, true }), framework::dataset::make("ReshapeWeights", { false, true })); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(FullyConnectedLayer) - -DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(datasets::SmallFullyConnectedLayerDataset(), datasets::LargeFullyConnectedLayerDataset()), - FullyConnectedParameters), - CNNDataTypes), - src_shape, weights_shape, bias_shape, dst_shape, transpose_weights, reshape_weights, data_type) -{ - // Set fixed point position data type allowed - int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0; - - TensorShape ws(weights_shape); - - // Transpose weights if not done in the function - if(!reshape_weights || !transpose_weights) - { - const size_t shape_x = ws.x(); - ws.set(0, ws.y()); - ws.set(1, shape_x); - } - - // Create tensors - CLTensor src = create_tensor(src_shape, data_type, 1, fixed_point_position); - CLTensor weights = create_tensor(ws, data_type, 1, fixed_point_position); - CLTensor bias = create_tensor(bias_shape, data_type, 1, fixed_point_position); - CLTensor dst = create_tensor(dst_shape, data_type, 1, fixed_point_position); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Create and configure function. - CLFullyConnectedLayer fc; - fc.configure(&src, &weights, &bias, &dst, transpose_weights, !reshape_weights); - - // Validate valid region - const ValidRegion dst_valid_region = shape_to_valid_region(dst_shape); - validate(dst.info()->valid_region(), dst_valid_region); -} - -template -using CLFullyConnectedLayerFixture = FullyConnectedLayerValidationFixture; - -TEST_SUITE(Float) -TEST_SUITE(FP16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLFullyConnectedLayerFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallFullyConnectedLayerDataset(), - FullyConnectedParameters), - framework::dataset::make("DataType", DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f16); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLFullyConnectedLayerFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeFullyConnectedLayerDataset(), - FullyConnectedParameters), - framework::dataset::make("DataType", DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f16); -} -TEST_SUITE_END() - -TEST_SUITE(FP32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLFullyConnectedLayerFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallFullyConnectedLayerDataset(), FullyConnectedParameters), - framework::dataset::make("DataType", DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLFullyConnectedLayerFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeFullyConnectedLayerDataset(), FullyConnectedParameters), - framework::dataset::make("DataType", DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -TEST_SUITE_END() -TEST_SUITE_END() - -template -using CLFullyConnectedLayerFixedPointFixture = FullyConnectedLayerValidationFixedPointFixture; - -TEST_SUITE(Quantized) -TEST_SUITE(QS8) -// Testing for fixed point position [1,6) as reciprocal limits the maximum fixed point position to 5 -FIXTURE_DATA_TEST_CASE(RunSmall, CLFullyConnectedLayerFixedPointFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallFullyConnectedLayerDataset(), - FullyConnectedParameters), - framework::dataset::make("DataType", - DataType::QS8)), - framework::dataset::make("FractionalBits", 1, 6))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_fixed_point); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLFullyConnectedLayerFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeFullyConnectedLayerDataset(), - FullyConnectedParameters), - framework::dataset::make("DataType", - DataType::QS8)), - framework::dataset::make("FractionalBits", 1, 6))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_fixed_point); -} -TEST_SUITE_END() - -TEST_SUITE(QS16) -// Testing for fixed point position [1,14) as reciprocal limits the maximum fixed point position to 14 -FIXTURE_DATA_TEST_CASE(RunSmall, CLFullyConnectedLayerFixedPointFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallFullyConnectedLayerDataset(), - FullyConnectedParameters), - framework::dataset::make("DataType", - DataType::QS16)), - framework::dataset::make("FractionalBits", 1, 14))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_fixed_point); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLFullyConnectedLayerFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeFullyConnectedLayerDataset(), - FullyConnectedParameters), - framework::dataset::make("DataType", - DataType::QS16)), - framework::dataset::make("FractionalBits", 1, 14))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_fixed_point); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/GEMM.cpp b/tests/validation_new/CL/GEMM.cpp deleted file mode 100644 index 7da5da3ed9..0000000000 --- a/tests/validation_new/CL/GEMM.cpp +++ /dev/null @@ -1,167 +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. - */ -#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/CLGEMM.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/LargeGEMMDataset.h" -#include "tests/datasets_new/SmallGEMMDataset.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/GEMMFixture.h" -#include "tests/validation_new/half.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr AbsoluteTolerance tolerance_f32(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for floating point data types */ -constexpr AbsoluteTolerance tolerance_f16(0.1f); /**< Tolerance value for comparing reference's output against implementation's output for floating point data types */ -constexpr AbsoluteTolerance tolerance_q(1.0f); /**< Tolerance value for comparing reference's output against implementation's output for fixed point data types */ - -/** CNN data types */ -const auto CNNDataTypes = framework::dataset::make("DataType", -{ - DataType::F16, - DataType::F32, - DataType::QS8, - DataType::QS16, -}); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(GEMM) - -DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::SmallGEMMDataset(), datasets::LargeGEMMDataset()), CNNDataTypes), - shape_a, shape_b, shape_c, output_shape, alpha, beta, data_type) -{ - // Set fixed point position data type allowed - const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0; - - // Create tensors - CLTensor a = create_tensor(shape_a, data_type, 1, fixed_point_position); - CLTensor b = create_tensor(shape_b, data_type, 1, fixed_point_position); - CLTensor c = create_tensor(shape_c, data_type, 1, fixed_point_position); - CLTensor dst = create_tensor(output_shape, data_type, 1, fixed_point_position); - - ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(c.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Create and configure function - CLGEMM gemm; - gemm.configure(&a, &b, &c, &dst, alpha, beta); - - //TODO(COMPMID-415): Validate valid region -} - -template -using CLGEMMFixture = GEMMValidationFixture; - -TEST_SUITE(Float) -TEST_SUITE(FP16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGEMMDataset(), framework::dataset::make("DataType", DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f16); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGEMMDataset(), framework::dataset::make("DataType", - DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f16); -} -TEST_SUITE_END() - -TEST_SUITE(FP32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGEMMDataset(), framework::dataset::make("DataType", DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGEMMDataset(), framework::dataset::make("DataType", DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -TEST_SUITE_END() -TEST_SUITE_END() - -template -using CLGEMMFixedPointFixture = GEMMValidationFixedPointFixture; - -TEST_SUITE(Quantized) -TEST_SUITE(QS8) -FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMFixedPointFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallGEMMDataset(), - framework::dataset::make("DataType", - DataType::QS8)), - framework::dataset::make("FractionalBits", 1, 7))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_q); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeGEMMDataset(), - framework::dataset::make("DataType", - DataType::QS8)), - framework::dataset::make("FractionalBits", 1, 7))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_q); -} -TEST_SUITE_END() - -TEST_SUITE(QS16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMFixedPointFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallGEMMDataset(), - framework::dataset::make("DataType", - DataType::QS16)), - framework::dataset::make("FractionalBits", 1, 14))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_q); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeGEMMDataset(), - framework::dataset::make("DataType", - DataType::QS16)), - framework::dataset::make("FractionalBits", 1, 14))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_q); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/L2Normalize.cpp b/tests/validation_new/CL/L2Normalize.cpp deleted file mode 100644 index d7882a842a..0000000000 --- a/tests/validation_new/CL/L2Normalize.cpp +++ /dev/null @@ -1,78 +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. - */ -#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/CLL2Normalize.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/L2NormalizeFixture.h" -#include "tests/validation_new/half.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/** Tolerance for float operations */ -constexpr AbsoluteTolerance tolerance_f32(0.00001f); - -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(L2Normalize) - -template -using CLL2NormalizeFixture = L2NormalizeValidationFixture; - -TEST_SUITE(Float) -TEST_SUITE(FP32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLL2NormalizeFixture, framework::DatasetMode::PRECOMMIT, - combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)), framework::dataset::make("Axis", { 0 })), framework::dataset::make("Epsilon", { 1e-12 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLL2NormalizeFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F32)), framework::dataset::make("Axis", { 0 })), framework::dataset::make("Epsilon", { 1e-12 }))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/MeanStdDev.cpp b/tests/validation_new/CL/MeanStdDev.cpp deleted file mode 100644 index 494e1001bc..0000000000 --- a/tests/validation_new/CL/MeanStdDev.cpp +++ /dev/null @@ -1,97 +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. - */ -#include "arm_compute/runtime/CL/functions/CLMeanStdDev.h" -#include "framework/Macros.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/MeanStdDevFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -constexpr RelativeTolerance tolerance_rel_high_error(0.05f); -constexpr RelativeTolerance tolerance_rel_low_error(0.0005f); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(MeanStdDev) - -DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), framework::dataset::make("DataType", DataType::U8)), shape, data_type) -{ - // Create tensors - CLTensor src = create_tensor(shape, data_type); - - // Create output variables - float mean = 0.f; - float std_dev = 0.f; - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Create configure function - CLMeanStdDev mean_std_dev_image; - mean_std_dev_image.configure(&src, &mean, &std_dev); - - // Validate valid region - const ValidRegion valid_region = shape_to_valid_region(shape); - validate(src.info()->valid_region(), valid_region); - - // Validate padding - const PaddingSize padding = PaddingCalculator(shape.x(), 8).required_padding(); - validate(src.info()->padding(), padding); -} - -template -using CLMeanStdDevFixture = MeanStdDevValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLMeanStdDevFixture, framework::DatasetMode::PRECOMMIT, 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() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/NormalizationLayer.cpp b/tests/validation_new/CL/NormalizationLayer.cpp deleted file mode 100644 index 37e77f3632..0000000000 --- a/tests/validation_new/CL/NormalizationLayer.cpp +++ /dev/null @@ -1,141 +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. - */ -#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/CLNormalizationLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/NormalizationTypesDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/NormalizationLayerFixture.h" -#include "tests/validation_new/half.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/** Tolerance for float operations */ -constexpr AbsoluteTolerance tolerance_f16(0.01f); -constexpr AbsoluteTolerance tolerance_f32(0.00001f); -/** Tolerance for fixed point operations */ -constexpr AbsoluteTolerance tolerance_qs8(2); -constexpr AbsoluteTolerance tolerance_qs16(2); - -/** Input data set. */ -const auto NormalizationDataset = combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("NormType", { NormType::IN_MAP_1D, NormType::CROSS_MAP })), - framework::dataset::make("NormalizationSize", 3, 9, 2)), - framework::dataset::make("Beta", { 0.5f, 1.f, 2.f })); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(NormalizationLayer) - -//TODO(COMPMID-415): Missing configuration? - -template -using CLNormalizationLayerFixture = NormalizationValidationFixture; - -TEST_SUITE(Float) -TEST_SUITE(FP16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLNormalizationLayerFixture, framework::DatasetMode::PRECOMMIT, combine(NormalizationDataset, framework::dataset::make("DataType", DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f16); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLNormalizationLayerFixture, framework::DatasetMode::NIGHTLY, combine(NormalizationDataset, framework::dataset::make("DataType", DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f16); -} -TEST_SUITE_END() - -TEST_SUITE(FP32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLNormalizationLayerFixture, framework::DatasetMode::PRECOMMIT, combine(NormalizationDataset, framework::dataset::make("DataType", DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLNormalizationLayerFixture, framework::DatasetMode::NIGHTLY, combine(NormalizationDataset, framework::dataset::make("DataType", DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -TEST_SUITE_END() -TEST_SUITE_END() - -template -using CLNormalizationLayerFixedPointFixture = NormalizationValidationFixedPointFixture; - -TEST_SUITE(Quantized) -TEST_SUITE(QS8) -// Testing for fixed point position [1,6) as reciprocal limits the maximum fixed point position to 5 -FIXTURE_DATA_TEST_CASE(RunSmall, CLNormalizationLayerFixedPointFixture, framework::DatasetMode::PRECOMMIT, combine(combine(NormalizationDataset, framework::dataset::make("DataType", - DataType::QS8)), - framework::dataset::make("FractionalBits", 1, 6))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_qs8); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLNormalizationLayerFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(NormalizationDataset, framework::dataset::make("DataType", - DataType::QS8)), - framework::dataset::make("FractionalBits", 1, 6))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_qs8); -} -TEST_SUITE_END() - -TEST_SUITE(QS16) -// Testing for fixed point position [1,14) as reciprocal limits the maximum fixed point position to 5 -FIXTURE_DATA_TEST_CASE(RunSmall, CLNormalizationLayerFixedPointFixture, framework::DatasetMode::PRECOMMIT, combine(combine(NormalizationDataset, framework::dataset::make("DataType", - DataType::QS16)), - framework::dataset::make("FractionalBits", 1, 14))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_qs16); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLNormalizationLayerFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(NormalizationDataset, framework::dataset::make("DataType", - DataType::QS16)), - framework::dataset::make("FractionalBits", 1, 14))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_qs16); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/PoolingLayer.cpp b/tests/validation_new/CL/PoolingLayer.cpp deleted file mode 100644 index d38a3b2c6a..0000000000 --- a/tests/validation_new/CL/PoolingLayer.cpp +++ /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. - */ -#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/CLPoolingLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/PoolingTypesDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/PoolingLayerFixture.h" -#include "tests/validation_new/half.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/** Input data set for float data types */ -const auto PoolingLayerDatasetFP = combine(combine(datasets::PoolingTypes(), framework::dataset::make("PoolingSize", { 2, 3, 7 })), - framework::dataset::make("PadStride", { PadStrideInfo(1, 1, 0, 0), PadStrideInfo(2, 1, 0, 0), PadStrideInfo(1, 2, 1, 1), PadStrideInfo(2, 2, 1, 0) })); - -/** Input data set for quantized data types */ -const auto PoolingLayerDatasetQS = combine(combine(datasets::PoolingTypes(), framework::dataset::make("PoolingSize", { 2, 3 })), - framework::dataset::make("PadStride", { PadStrideInfo(1, 1, 0, 0), PadStrideInfo(2, 1, 0, 0), PadStrideInfo(1, 2, 1, 1), PadStrideInfo(2, 2, 1, 0) })); - -constexpr AbsoluteTolerance tolerance_f32(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for float types */ -constexpr AbsoluteTolerance tolerance_f16(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for float types */ -constexpr AbsoluteTolerance tolerance_qs8(3); /**< Tolerance value for comparing reference's output against implementation's output for quantized input */ -constexpr AbsoluteTolerance tolerance_qs16(6); /**< Tolerance value for comparing reference's output against implementation's output for quantized input */ -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(PoolingLayer) - -template -using CLPoolingLayerFixture = PoolingLayerValidationFixture; - -TEST_SUITE(Float) -TEST_SUITE(FP32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLPoolingLayerFixture, framework::DatasetMode::ALL, combine(datasets::SmallShapes(), combine(PoolingLayerDatasetFP, framework::dataset::make("DataType", - DataType::F32)))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLPoolingLayerFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), combine(PoolingLayerDatasetFP, framework::dataset::make("DataType", - DataType::F32)))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -TEST_SUITE_END() - -TEST_SUITE(FP16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLPoolingLayerFixture, framework::DatasetMode::ALL, combine(datasets::SmallShapes(), combine(PoolingLayerDatasetFP, - framework::dataset::make("DataType", DataType::F16)))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f16); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLPoolingLayerFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), combine(PoolingLayerDatasetFP, - framework::dataset::make("DataType", DataType::F16)))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f16); -} -TEST_SUITE_END() -TEST_SUITE_END() - -template -using CLPoolingLayerFixedPointFixture = PoolingLayerValidationFixedPointFixture; - -TEST_SUITE(Quantized) -TEST_SUITE(QS8) -FIXTURE_DATA_TEST_CASE(RunSmall, CLPoolingLayerFixedPointFixture, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), combine(PoolingLayerDatasetQS, - framework::dataset::make("DataType", DataType::QS8))), - framework::dataset::make("FractionalBits", 1, 4))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_qs8); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLPoolingLayerFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), combine(PoolingLayerDatasetQS, - framework::dataset::make("DataType", DataType::QS8))), - framework::dataset::make("FractionalBits", 1, 4))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_qs8); -} -TEST_SUITE_END() - -TEST_SUITE(QS16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLPoolingLayerFixedPointFixture, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), combine(PoolingLayerDatasetQS, - framework::dataset::make("DataType", DataType::QS16))), - framework::dataset::make("FractionalBits", 1, 12))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_qs16); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLPoolingLayerFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), combine(PoolingLayerDatasetQS, - framework::dataset::make("DataType", DataType::QS16))), - framework::dataset::make("FractionalBits", 1, 12))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_qs16); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/ReductionOperation.cpp b/tests/validation_new/CL/ReductionOperation.cpp deleted file mode 100644 index af49d736ab..0000000000 --- a/tests/validation_new/CL/ReductionOperation.cpp +++ /dev/null @@ -1,78 +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. - */ -#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/CLReductionOperation.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ReductionOperationDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/ReductionOperationFixture.h" -#include "tests/validation_new/half.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/** Tolerance for float operations */ -constexpr RelativeTolerance tolerance_f32(0.00001f); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(ReductionOperation) - -template -using CLReductionOperationFixture = ReductionOperationValidationFixture; - -TEST_SUITE(Float) -TEST_SUITE(FP32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLReductionOperationFixture, framework::DatasetMode::PRECOMMIT, - combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F32)), framework::dataset::make("Axis", { 0 })), datasets::ReductionOperations())) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLReductionOperationFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F32)), framework::dataset::make("Axis", { 0 })), datasets::ReductionOperations())) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/Scale.cpp b/tests/validation_new/CL/Scale.cpp deleted file mode 100644 index e28555ac21..0000000000 --- a/tests/validation_new/CL/Scale.cpp +++ /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. - */ -#include "arm_compute/core/Helpers.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/functions/CLScale.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/BorderModeDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Helpers.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/ScaleFixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/** Tolerance */ -constexpr AbsoluteTolerance tolerance(1); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(Scale) - -DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", DataType::U8)), - framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })), - datasets::BorderModes()), - shape, data_type, policy, border_mode) -{ - std::mt19937 generator(library->seed()); - std::uniform_real_distribution distribution_float(0.25, 2); - const float scale_x = distribution_float(generator); - const float scale_y = distribution_float(generator); - std::uniform_int_distribution distribution_u8(0, 255); - uint8_t constant_border_value = distribution_u8(generator); - - // Create tensors - CLTensor src = create_tensor(shape, data_type); - TensorShape shape_scaled(shape); - shape_scaled.set(0, shape[0] * scale_x); - shape_scaled.set(1, shape[1] * scale_y); - CLTensor dst = create_tensor(shape_scaled, data_type); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Create and configure function - CLScale clscale; - clscale.configure(&src, &dst, policy, border_mode, constant_border_value); - - // Validate valid region - const ValidRegion dst_valid_region = calculate_valid_region_scale(*(src.info()), shape_scaled, policy, BorderSize(1), (border_mode == BorderMode::UNDEFINED)); - - validate(dst.info()->valid_region(), dst_valid_region); - - // Validate padding - PaddingCalculator calculator(shape_scaled.x(), 4); - calculator.set_border_mode(border_mode); - - const PaddingSize read_padding(1); - const PaddingSize write_padding = calculator.required_padding(PaddingCalculator::Option::EXCLUDE_BORDER); - validate(src.info()->padding(), read_padding); - validate(dst.info()->padding(), write_padding); -} - -template -using CLScaleFixture = ScaleValidationFixture; - -FIXTURE_DATA_TEST_CASE(RunSmall, CLScaleFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::U8)), - framework::dataset::make("InterpolationPolicy", -{ InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })), -datasets::BorderModes())) -{ - //Create valid region - TensorInfo src_info(_shape, 1, _data_type); - const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _policy, BorderSize(1), (_border_mode == BorderMode::UNDEFINED)); - - // Validate output - validate(CLAccessor(_target), _reference, valid_region, tolerance); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLScaleFixture, 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())) -{ - //Create valid region - TensorInfo src_info(_shape, 1, _data_type); - const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _policy, BorderSize(1), (_border_mode == BorderMode::UNDEFINED)); - - // Validate output - validate(CLAccessor(_target), _reference, valid_region, tolerance); -} -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/CL/SoftmaxLayer.cpp b/tests/validation_new/CL/SoftmaxLayer.cpp deleted file mode 100644 index d13236a2f9..0000000000 --- a/tests/validation_new/CL/SoftmaxLayer.cpp +++ /dev/null @@ -1,168 +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. - */ -#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/CLSoftmaxLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" -#include "tests/CL/CLAccessor.h" -#include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/SoftmaxLayerFixture.h" -#include "tests/validation_new/half.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/** Tolerance for float operations */ -constexpr AbsoluteTolerance tolerance_f16(0.002f); -constexpr AbsoluteTolerance tolerance_f32(0.000001f); -/** Tolerance for fixed point operations */ -constexpr AbsoluteTolerance tolerance_fixed_point(2); - -/** CNN data types */ -const auto CNNDataTypes = framework::dataset::make("DataType", -{ - DataType::F16, - DataType::F32, - DataType::QS8, - DataType::QS16, -}); -} // namespace - -TEST_SUITE(CL) -TEST_SUITE(SoftmaxLayer) - -DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), CNNDataTypes), shape, data_type) -{ - // Set fixed point position data type allowed - const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0; - - // Create tensors - CLTensor src = create_tensor(shape, data_type, 1, fixed_point_position); - CLTensor dst = create_tensor(shape, data_type, 1, fixed_point_position); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Create and configure function - CLSoftmaxLayer smx_layer; - smx_layer.configure(&src, &dst); - - // Validate valid region - const ValidRegion valid_region = shape_to_valid_region(shape); - validate(src.info()->valid_region(), valid_region); - validate(dst.info()->valid_region(), valid_region); - - // Validate padding - const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding(); - validate(src.info()->padding(), padding); - validate(dst.info()->padding(), padding); -} - -template -using CLSoftmaxLayerFixture = SoftmaxValidationFixture; - -TEST_SUITE(Float) -TEST_SUITE(FP16) -FIXTURE_DATA_TEST_CASE(RunSmall, CLSoftmaxLayerFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f16); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLSoftmaxLayerFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F16))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f16); -} -TEST_SUITE_END() - -TEST_SUITE(FP32) -FIXTURE_DATA_TEST_CASE(RunSmall, CLSoftmaxLayerFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLSoftmaxLayerFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F32))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_f32); -} -TEST_SUITE_END() -TEST_SUITE_END() - -template -using CLSoftmaxLayerFixedPointFixture = SoftmaxValidationFixedPointFixture; - -TEST_SUITE(Quantized) -TEST_SUITE(QS8) -// Testing for fixed point position [1,6) as reciprocal limits the maximum fixed point position to 5 -FIXTURE_DATA_TEST_CASE(RunSmall, CLSoftmaxLayerFixedPointFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::QS8)), - framework::dataset::make("FractionalBits", 1, 6))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_fixed_point); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLSoftmaxLayerFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", - DataType::QS8)), - framework::dataset::make("FractionalBits", 1, 6))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_fixed_point); -} -TEST_SUITE_END() - -TEST_SUITE(QS16) -// Testing for fixed point position [1,14) as reciprocal limits the maximum fixed point position to 14 -FIXTURE_DATA_TEST_CASE(RunSmall, CLSoftmaxLayerFixedPointFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", - DataType::QS16)), - framework::dataset::make("FractionalBits", 1, 14))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_fixed_point); -} -FIXTURE_DATA_TEST_CASE(RunLarge, CLSoftmaxLayerFixedPointFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", - DataType::QS16)), - framework::dataset::make("FractionalBits", 1, 14))) -{ - // Validate output - validate(CLAccessor(_target), _reference, tolerance_fixed_point); -} -TEST_SUITE_END() -TEST_SUITE_END() - -TEST_SUITE_END() -TEST_SUITE_END() -} // namespace validation -} // namespace test -} // namespace arm_compute -- cgit v1.2.1