aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/UNIT
diff options
context:
space:
mode:
authorVidhya Sudhan Loganathan <vidhyasudhan.loganathan@arm.com>2018-06-18 14:40:56 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:53:09 +0000
commit0fc25454b6ce499b7f89792f91b81a61a42d3182 (patch)
tree0c988cbbef3f5f1967cc2f77672d05a702191349 /tests/validation/UNIT
parentf5f0ecca39c905bc8c1f90e7469eed2221ca662f (diff)
downloadComputeLibrary-0fc25454b6ce499b7f89792f91b81a61a42d3182.tar.gz
COMPMID-970 : Remove QS8 / QS16 support
Remove QS8 and QS16 validation and benchmark tests Change-Id: I566f1474c1fafcb3903115ec2d3a003d73e4c93b Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/133762 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'tests/validation/UNIT')
-rw-r--r--tests/validation/UNIT/FixedPoint.cpp211
-rw-r--r--tests/validation/UNIT/TensorInfo.cpp6
2 files changed, 0 insertions, 217 deletions
diff --git a/tests/validation/UNIT/FixedPoint.cpp b/tests/validation/UNIT/FixedPoint.cpp
deleted file mode 100644
index 66a4b25fc9..0000000000
--- a/tests/validation/UNIT/FixedPoint.cpp
+++ /dev/null
@@ -1,211 +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 "tests/validation/FixedPoint.h"
-
-#include "tests/Globals.h"
-#include "tests/framework/Asserts.h"
-#include "tests/framework/Macros.h"
-#include "tests/framework/datasets/Datasets.h"
-#include "tests/validation/Validation.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace
-{
-const auto FuncNamesDataset = framework::dataset::make("FunctionNames", { FixedPointOp::ADD,
- FixedPointOp::SUB,
- FixedPointOp::MUL,
- FixedPointOp::EXP,
- FixedPointOp::LOG,
- FixedPointOp::INV_SQRT
- });
-
-template <typename T>
-void load_array_from_numpy(const std::string &file, std::vector<unsigned long> &shape, std::vector<T> &data) // NOLINT
-{
- try
- {
- npy::LoadArrayFromNumpy(file, shape, data);
- }
- catch(const std::runtime_error &e)
- {
- throw framework::FileNotFound("Could not load npy file: " + file + " (" + e.what() + ")");
- }
-}
-} // namespace
-
-TEST_SUITE(UNIT)
-TEST_SUITE(FixedPoint)
-
-// *INDENT-OFF*
-// clang-format off
-DATA_TEST_CASE(FixedPointQS8Inputs, framework::DatasetMode::ALL, combine(
- FuncNamesDataset,
- framework::dataset::make("FractionalBits", 1, 7)),
- func_name, frac_bits)
-// clang-format on
-// *INDENT-ON*
-{
- std::vector<double> data;
- std::vector<unsigned long> shape; //NOLINT
-
- std::string func_name_lower = to_string(func_name);
- std::transform(func_name_lower.begin(), func_name_lower.end(), func_name_lower.begin(), ::tolower);
-
- const std::string inputs_file = library->path()
- + "fixed_point/"
- + func_name_lower
- + "_Q8."
- + support::cpp11::to_string(frac_bits)
- + ".in.npy";
-
- load_array_from_numpy(inputs_file, shape, data);
-
- // Values stored as doubles so reinterpret as floats
- const auto *float_val = reinterpret_cast<float *>(&data[0]);
- const size_t num_elements = data.size() * sizeof(double) / sizeof(float);
-
- for(unsigned int i = 0; i < num_elements; ++i)
- {
- // Convert to fixed point
- fixed_point_arithmetic::fixed_point<int8_t> in_val(float_val[i], frac_bits);
-
- // Check that the value didn't change
- ARM_COMPUTE_EXPECT(static_cast<float>(in_val) == float_val[i], framework::LogLevel::ERRORS);
- }
-}
-
-//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.
-
-// *INDENT-OFF*
-// clang-format off
-DATA_TEST_CASE(FixedPointQS8Outputs, framework::DatasetMode::ALL, zip(combine(
- FuncNamesDataset,
- framework::dataset::make("FractionalBits", 1, 7)),
- framework::dataset::make("ExpectedFailures", { 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)
-// clang-format on
-// *INDENT-ON*
-{
- std::vector<double> in_data;
- std::vector<unsigned long> in_shape; //NOLINT
-
- std::vector<double> out_data;
- std::vector<unsigned long> out_shape; //NOLINT
-
- std::string func_name_lower = to_string(func_name);
- std::transform(func_name_lower.begin(), func_name_lower.end(), func_name_lower.begin(), ::tolower);
-
- const std::string base_file_name = library->path()
- + "fixed_point/"
- + func_name_lower
- + "_Q8."
- + support::cpp11::to_string(frac_bits);
-
- const std::string inputs_file = base_file_name + ".in.npy";
- const std::string reference_file = base_file_name + ".out.npy";
-
- load_array_from_numpy(inputs_file, in_shape, in_data);
- load_array_from_numpy(reference_file, out_shape, out_data);
-
- ARM_COMPUTE_EXPECT(in_shape.front() == out_shape.front(), framework::LogLevel::ERRORS);
-
- const float step_size = std::pow(2.f, -frac_bits);
- int64_t num_mismatches = 0;
-
- // Values stored as doubles so reinterpret as floats
- const auto *float_val = reinterpret_cast<float *>(&in_data[0]);
- const auto *ref_val = reinterpret_cast<float *>(&out_data[0]);
-
- const size_t num_elements = in_data.size() * sizeof(double) / sizeof(float);
-
- for(unsigned int i = 0; i < num_elements; ++i)
- {
- fixed_point_arithmetic::fixed_point<int8_t> in_val(float_val[i], frac_bits);
- fixed_point_arithmetic::fixed_point<int8_t> out_val(0.f, frac_bits);
-
- float tolerance = 0.f;
-
- if(func_name == FixedPointOp::ADD)
- {
- out_val = in_val + in_val;
- }
- else if(func_name == FixedPointOp::SUB)
- {
- out_val = in_val - in_val; //NOLINT
- }
- else if(func_name == FixedPointOp::MUL)
- {
- tolerance = 1.f * step_size;
- out_val = in_val * in_val;
- }
- else if(func_name == FixedPointOp::EXP)
- {
- tolerance = 2.f * step_size;
- out_val = fixed_point_arithmetic::exp(in_val);
- }
- else if(func_name == FixedPointOp::LOG)
- {
- tolerance = 4.f * step_size;
- out_val = fixed_point_arithmetic::log(in_val);
- }
- else if(func_name == FixedPointOp::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[i]) > tolerance)
- {
- ARM_COMPUTE_TEST_INFO("input = " << in_val);
- ARM_COMPUTE_TEST_INFO("output = " << out_val);
- ARM_COMPUTE_TEST_INFO("reference = " << ref_val[i]);
- ARM_COMPUTE_TEST_INFO("tolerance = " << tolerance);
-
- ARM_COMPUTE_TEST_INFO((std::abs(static_cast<float>(out_val) - ref_val[i]) <= tolerance));
-
- ++num_mismatches;
- }
- }
-
- ARM_COMPUTE_EXPECT(num_mismatches == expected_failures, framework::LogLevel::ERRORS);
-}
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/validation/UNIT/TensorInfo.cpp b/tests/validation/UNIT/TensorInfo.cpp
index dd7ae6d18c..b78f656932 100644
--- a/tests/validation/UNIT/TensorInfo.cpp
+++ b/tests/validation/UNIT/TensorInfo.cpp
@@ -112,12 +112,6 @@ TEST_CASE(TensorInfoBuild, framework::DatasetMode::ALL)
ARM_COMPUTE_EXPECT(info.data_type() == DataType::S32, framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(info.num_channels() == 3, framework::LogLevel::ERRORS);
- // Update data type channels and set fixed point position
- info.set_data_type(DataType::QS8).set_num_channels(1).set_fixed_point_position(3);
- ARM_COMPUTE_EXPECT(info.data_type() == DataType::QS8, framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(info.num_channels() == 1, framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(info.fixed_point_position() == 3, framework::LogLevel::ERRORS);
-
// Update data type and set quantization info
info.set_data_type(DataType::QASYMM8).set_quantization_info(QuantizationInfo(0.5f, 15));
ARM_COMPUTE_EXPECT(info.data_type() == DataType::QASYMM8, framework::LogLevel::ERRORS);