diff options
author | Moritz Pflanzer <moritz.pflanzer@arm.com> | 2017-09-01 20:41:12 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | a09de0c8b2ed0f1481502d3b023375609362d9e3 (patch) | |
tree | e34b56d9ca69b025d7d9b943cc4df59cd458f6cb /tests/validation/UNIT | |
parent | 5280071b336d53aff94ca3a6c70ebbe6bf03f4c3 (diff) | |
download | ComputeLibrary-a09de0c8b2ed0f1481502d3b023375609362d9e3.tar.gz |
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 <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/validation/UNIT')
-rw-r--r-- | tests/validation/UNIT/CMakeLists.txt | 37 | ||||
-rw-r--r-- | tests/validation/UNIT/FixedPoint.cpp | 164 | ||||
-rw-r--r-- | tests/validation/UNIT/TensorInfo.cpp | 91 | ||||
-rw-r--r-- | tests/validation/UNIT/TensorShape.cpp | 70 | ||||
-rw-r--r-- | tests/validation/UNIT/Utils.cpp | 94 |
5 files changed, 0 insertions, 456 deletions
diff --git a/tests/validation/UNIT/CMakeLists.txt b/tests/validation/UNIT/CMakeLists.txt deleted file mode 100644 index a0603f150c..0000000000 --- a/tests/validation/UNIT/CMakeLists.txt +++ /dev/null @@ -1,37 +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. -cmake_minimum_required (VERSION 3.1) - -set(arm_compute_test_validation_UNIT_SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/TensorInfo.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Utils.cpp -) - -add_library(arm_compute_test_validation_UNIT OBJECT - ${arm_compute_test_validation_UNIT_SOURCE_FILES} -) - -set(arm_compute_test_validation_TARGET_OBJECTS - ${arm_compute_test_validation_TARGET_OBJECTS} - $<TARGET_OBJECTS:arm_compute_test_validation_UNIT> - PARENT_SCOPE -) diff --git a/tests/validation/UNIT/FixedPoint.cpp b/tests/validation/UNIT/FixedPoint.cpp deleted file mode 100644 index 00cab9eb29..0000000000 --- a/tests/validation/UNIT/FixedPoint.cpp +++ /dev/null @@ -1,164 +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 "validation/FixedPoint.h" - -#include "TypePrinter.h" -#include "Utils.h" -#include "support/ToolchainSupport.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" - -#include "boost_wrapper.h" - -#include <fstream> -#include <vector> - -using namespace arm_compute; -using namespace arm_compute::test; -using namespace arm_compute::test::validation; - -namespace -{ -std::string func_names[] = -{ - "add", "sub", "mul", "exp", "log", "inv_sqrt" -}; -} // namespace - -#ifndef DOXYGEN_SKIP_THIS -BOOST_AUTO_TEST_SUITE(UNIT) -BOOST_AUTO_TEST_SUITE(FixedPoint) - -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) -BOOST_DATA_TEST_CASE(FixedPointQS8Inputs, boost::unit_test::data::make(func_names) * boost::unit_test::data::xrange(1, 7), func_name, frac_bits) -{ - const std::string base_file_name = user_config.path.get() + "/dumps/" + func_name + "_Q8." + support::cpp11::to_string(frac_bits); - std::ifstream inputs_file{ base_file_name + ".in", std::ios::binary | std::ios::in }; - - BOOST_TEST_INFO(base_file_name + ".in"); - BOOST_TEST_REQUIRE(inputs_file.good()); - - float float_val = 0.f; - - // Read first value - inputs_file.read(reinterpret_cast<char *>(&float_val), sizeof(float_val)); - - while(inputs_file.good()) - { - // Convert to fixed point - fixed_point_arithmetic::fixed_point<int8_t> in_val(float_val, frac_bits); - - // Check that the value didn't change - BOOST_TEST(static_cast<float>(in_val) == float_val); - - // Read next value - inputs_file.read(reinterpret_cast<char *>(&float_val), sizeof(float_val)); - } -} - -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) -//FIXME: Figure out how to handle expected failures properly -// The last input argument specifies the expected number of failures for a -// given combination of (function name, number of fractional bits) as defined -// by the first two arguments. -BOOST_DATA_TEST_CASE(FixedPointQS8Outputs, (boost::unit_test::data::make(func_names) * boost::unit_test::data::xrange(1, 7)) ^ (boost::unit_test::data::make({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 33, 96 })), - func_name, frac_bits, expected_failures) -{ - const std::string base_file_name = user_config.path.get() + "/dumps/" + func_name + "_Q8." + support::cpp11::to_string(frac_bits); - std::ifstream inputs_file{ base_file_name + ".in", std::ios::binary | std::ios::in }; - std::ifstream reference_file{ base_file_name + ".out", std::ios::binary | std::ios::in }; - - BOOST_TEST_INFO(base_file_name + ".in"); - BOOST_TEST_REQUIRE(inputs_file.good()); - BOOST_TEST_INFO(base_file_name + ".out"); - BOOST_TEST_REQUIRE(reference_file.good()); - - const float step_size = std::pow(2.f, -frac_bits); - - float float_val = 0.f; - float ref_val = 0.f; - int64_t num_mismatches = 0; - - // Read first values - inputs_file.read(reinterpret_cast<char *>(&float_val), sizeof(float_val)); - reference_file.read(reinterpret_cast<char *>(&ref_val), sizeof(ref_val)); - - while(inputs_file.good() && reference_file.good()) - { - fixed_point_arithmetic::fixed_point<int8_t> in_val(float_val, frac_bits); - fixed_point_arithmetic::fixed_point<int8_t> out_val(0.f, frac_bits); - - float tolerance = 0.f; - - if(func_name == "add") - { - out_val = in_val + in_val; - } - else if(func_name == "sub") - { - out_val = in_val - in_val; //NOLINT - } - else if(func_name == "mul") - { - tolerance = 1.f * step_size; - out_val = in_val * in_val; - } - else if(func_name == "exp") - { - tolerance = 2.f * step_size; - out_val = fixed_point_arithmetic::exp(in_val); - } - else if(func_name == "log") - { - tolerance = 4.f * step_size; - out_val = fixed_point_arithmetic::log(in_val); - } - else if(func_name == "inv_sqrt") - { - tolerance = 5.f * step_size; - out_val = fixed_point_arithmetic::inv_sqrt(in_val); - } - - if(std::abs(static_cast<float>(out_val) - ref_val) > tolerance) - { - BOOST_TEST_INFO("input = " << in_val); - BOOST_TEST_INFO("output = " << out_val); - BOOST_TEST_INFO("reference = " << ref_val); - BOOST_TEST_INFO("tolerance = " << tolerance); - BOOST_TEST_WARN((std::abs(static_cast<float>(out_val) - ref_val) <= tolerance)); - - ++num_mismatches; - } - - // Read next values - inputs_file.read(reinterpret_cast<char *>(&float_val), sizeof(float_val)); - reference_file.read(reinterpret_cast<char *>(&ref_val), sizeof(ref_val)); - } - - BOOST_TEST(num_mismatches == expected_failures); -} - -BOOST_AUTO_TEST_SUITE_END() -BOOST_AUTO_TEST_SUITE_END() -#endif /* DOXYGEN_SKIP_THIS */ diff --git a/tests/validation/UNIT/TensorInfo.cpp b/tests/validation/UNIT/TensorInfo.cpp deleted file mode 100644 index c74cfebfe4..0000000000 --- a/tests/validation/UNIT/TensorInfo.cpp +++ /dev/null @@ -1,91 +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 "TypePrinter.h" -#include "validation/Validation.h" - -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Types.h" - -#include "boost_wrapper.h" - -using namespace arm_compute; -using namespace arm_compute::test; -using namespace arm_compute::test::validation; - -#ifndef DOXYGEN_SKIP_THIS -BOOST_AUTO_TEST_SUITE(UNIT) -BOOST_AUTO_TEST_SUITE(TensorInfoValidation) - -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) -BOOST_DATA_TEST_CASE(AutoPadding, - boost::unit_test::data::make({ TensorShape{}, - TensorShape{ 10U }, - TensorShape{ 10U, 10U }, - TensorShape{ 10U, 10U, 10U }, - TensorShape{ 10U, 10U, 10U, 10U }, - TensorShape{ 10U, 10U, 10U, 10U, 10U }, - TensorShape{ 10U, 10U, 10U, 10U, 10U, 10U } - }) - ^ boost::unit_test::data::make({ PaddingSize{ 0, 0, 0, 0 }, - PaddingSize{ 0, 36, 0, 4 }, - PaddingSize{ 4, 36, 4, 4 }, - PaddingSize{ 4, 36, 4, 4 }, - PaddingSize{ 4, 36, 4, 4 }, - PaddingSize{ 4, 36, 4, 4 }, - PaddingSize{ 4, 36, 4, 4 } - }) - ^ boost::unit_test::data::make({ Strides{}, - Strides{ 1U }, - Strides{ 1U, 50U }, - Strides{ 1U, 50U, 900U }, - Strides{ 1U, 50U, 900U, 9000U }, - Strides{ 1U, 50U, 900U, 9000U, 90000U }, - Strides{ 1U, 50U, 900U, 9000U, 90000U, 900000U } - }) - ^ boost::unit_test::data::make( -{ - 0, - 4, - 204, - 204, - 204, - 204, - 204, -}), -shape, auto_padding, strides, offset) -{ - TensorInfo info{ shape, Format::U8 }; - - BOOST_TEST(!info.has_padding()); - - info.auto_padding(); - - validate(info.padding(), auto_padding); - BOOST_TEST(compare_dimensions(info.strides_in_bytes(), strides)); - BOOST_TEST(info.offset_first_element_in_bytes() == offset); -} - -BOOST_AUTO_TEST_SUITE_END() -BOOST_AUTO_TEST_SUITE_END() -#endif /* DOXYGEN_SKIP_THIS */ diff --git a/tests/validation/UNIT/TensorShape.cpp b/tests/validation/UNIT/TensorShape.cpp deleted file mode 100644 index 4c1ef680b5..0000000000 --- a/tests/validation/UNIT/TensorShape.cpp +++ /dev/null @@ -1,70 +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 "TypePrinter.h" -#include "validation/Validation.h" - -#include "arm_compute/core/TensorShape.h" - -#include "boost_wrapper.h" - -using namespace arm_compute; -using namespace arm_compute::test; -using namespace arm_compute::test::validation; - -#ifndef DOXYGEN_SKIP_THIS -BOOST_AUTO_TEST_SUITE(UNIT) -BOOST_AUTO_TEST_SUITE(TensorShapeValidation) - -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) -BOOST_DATA_TEST_CASE(Construction, - boost::unit_test::data::make({ TensorShape{}, - TensorShape{ 1U }, - TensorShape{ 2U }, - TensorShape{ 2U, 3U }, - TensorShape{ 2U, 3U, 5U }, - TensorShape{ 2U, 3U, 5U, 7U }, - TensorShape{ 2U, 3U, 5U, 7U, 11U }, - TensorShape{ 2U, 3U, 5U, 7U, 11U, 13U } - }) - ^ boost::unit_test::data::make({ 0, 0, 1, 2, 3, 4, 5, 6 }) ^ boost::unit_test::data::make({ 0, 1, 2, 6, 30, 210, 2310, 30030 }), - shape, num_dimensions, total_size) -{ - BOOST_TEST(shape.num_dimensions() == num_dimensions); - BOOST_TEST(shape.total_size() == total_size); -} - -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) -BOOST_DATA_TEST_CASE(SetEmpty, boost::unit_test::data::make({ 0, 1, 2, 3, 4, 5 }), dimension) -{ - TensorShape shape; - - shape.set(dimension, 10); - - BOOST_TEST(shape.num_dimensions() == dimension + 1); - BOOST_TEST(shape.total_size() == 10); -} - -BOOST_AUTO_TEST_SUITE_END() -BOOST_AUTO_TEST_SUITE_END() -#endif /* DOXYGEN_SKIP_THIS */ diff --git a/tests/validation/UNIT/Utils.cpp b/tests/validation/UNIT/Utils.cpp deleted file mode 100644 index e28ca19620..0000000000 --- a/tests/validation/UNIT/Utils.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 "Utils.h" - -#include "TypePrinter.h" -#include "validation/Validation.h" - -#include "boost_wrapper.h" - -#include <stdexcept> - -using namespace arm_compute; -using namespace arm_compute::test; -using namespace arm_compute::test::validation; - -#ifndef DOXYGEN_SKIP_THIS -BOOST_AUTO_TEST_SUITE(UNIT) -BOOST_AUTO_TEST_SUITE(Utils) - -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) -BOOST_DATA_TEST_CASE(RoundHalfUp, boost::unit_test::data::make({ 1.f, 1.2f, 1.5f, 2.5f, 2.9f, -3.f, -3.5f, -3.8f, -4.3f, -4.5f }) ^ boost::unit_test::data::make({ 1.f, 1.f, 2.f, 3.f, 3.f, -3.f, -3.f, -4.f, -4.f, -4.f }), - value, result) -{ - BOOST_TEST(round_half_up(value) == result); -} - -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) -BOOST_DATA_TEST_CASE(RoundHalfEven, boost::unit_test::data::make({ 1.f, 1.2f, 1.5f, 2.5f, 2.9f, -3.f, -3.5f, -3.8f, -4.3f, -4.5f }) ^ boost::unit_test::data::make({ 1.f, 1.f, 2.f, 2.f, 3.f, -3.f, -4.f, -4.f, -4.f, -4.f }), - value, result) -{ - BOOST_TEST(round_half_even(value) == result); -} - -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) -BOOST_DATA_TEST_CASE(Index2Coord, boost::unit_test::data::make({ TensorShape{ 1U }, TensorShape{ 2U }, TensorShape{ 2U, 3U } }) ^ boost::unit_test::data::make({ 0, 1, 2 }) ^ - boost::unit_test::data::make({ Coordinates{ 0 }, Coordinates{ 1 }, Coordinates{ 0, 1 } }), shape, index, ref_coordinate) -{ - Coordinates coordinate = index2coord(shape, index); - - BOOST_TEST(compare_dimensions(coordinate, ref_coordinate)); -} - -//FIXME: Negative tests only work in debug mode -#if 0 -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) -BOOST_DATA_TEST_CASE(Index2CoordFail, boost::unit_test::data::make({ TensorShape{}, TensorShape{ 2U }, TensorShape{ 2U } }) ^ boost::unit_test::data::make({ 0, -1, 2 }), shape, index) -{ - BOOST_CHECK_THROW(index2coord(shape, index), std::runtime_error); -} -#endif /* 0 */ - -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) -BOOST_DATA_TEST_CASE(Coord2Index, boost::unit_test::data::make({ TensorShape{ 1U }, TensorShape{ 2U }, TensorShape{ 2U, 3U } }) ^ boost::unit_test::data::make({ Coordinates{ 0 }, Coordinates{ 1 }, Coordinates{ 0, 1 } }) - ^ boost::unit_test::data::make({ 0, 1, 2 }), - shape, coordinate, ref_index) -{ - int index = coord2index(shape, coordinate); - - BOOST_TEST(index == ref_index); -} - -//FIXME: Negative tests only work in debug mode -#if 0 -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly")) -BOOST_DATA_TEST_CASE(Coord2IndexFail, boost::unit_test::data::make({ TensorShape{}, TensorShape{ 2U } }) ^ boost::unit_test::data::make({ Coordinates{ 0 }, Coordinates{} }), shape, coordinate) -{ - BOOST_CHECK_THROW(coord2index(shape, coordinate), std::runtime_error); -} -#endif /* 0 */ - -BOOST_AUTO_TEST_SUITE_END() -BOOST_AUTO_TEST_SUITE_END() -#endif /* DOXYGEN_SKIP_THIS */ |