diff options
author | Moritz Pflanzer <moritz.pflanzer@arm.com> | 2017-08-02 09:42:27 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-09-17 14:16:42 +0100 |
commit | 6106a4de410e7cc59515dd889e159bee7aa45d35 (patch) | |
tree | 80dd491ae3865dd00a8e272bbf66b72274a0efe2 /tests/validation_new/Validation.cpp | |
parent | d8e765ba79772ecc3deda89ae3adab903c744296 (diff) | |
download | ComputeLibrary-6106a4de410e7cc59515dd889e159bee7aa45d35.tar.gz |
COMPMID-415: Use absolute and relative tolerance
Change-Id: Ib779fa307e05fa67172ddaf521239b4c746debc8
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/82229
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'tests/validation_new/Validation.cpp')
-rw-r--r-- | tests/validation_new/Validation.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/tests/validation_new/Validation.cpp b/tests/validation_new/Validation.cpp index a492bb6505..fec7c10939 100644 --- a/tests/validation_new/Validation.cpp +++ b/tests/validation_new/Validation.cpp @@ -128,17 +128,16 @@ void check_border_element(const IAccessor &tensor, const Coordinates &id, { const size_t channel_offset = channel * channel_size; const double target = get_double_data(ptr + channel_offset, tensor.data_type()); - const double ref = get_double_data(static_cast<const uint8_t *>(border_value) + channel_offset, tensor.data_type()); - const bool equal = is_equal(target, ref); + const double reference = get_double_data(static_cast<const uint8_t *>(border_value) + channel_offset, tensor.data_type()); - ARM_COMPUTE_TEST_INFO("id = " << id); - ARM_COMPUTE_TEST_INFO("channel = " << channel); - ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << target); - ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << ref); - ARM_COMPUTE_EXPECT_EQUAL(target, ref, framework::LogLevel::DEBUG); - - if(!equal) + if(!compare<AbsoluteTolerance<double>, double>(target, reference)) { + ARM_COMPUTE_TEST_INFO("id = " << id); + ARM_COMPUTE_TEST_INFO("channel = " << channel); + ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << target); + ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << reference); + ARM_COMPUTE_EXPECT_EQUAL(target, reference, framework::LogLevel::DEBUG); + ++num_mismatches; } @@ -191,17 +190,16 @@ void validate(const IAccessor &tensor, const void *reference_value) { const size_t channel_offset = channel * channel_size; const double target = get_double_data(ptr + channel_offset, tensor.data_type()); - const double ref = get_double_data(reference_value, tensor.data_type()); - const bool equal = is_equal(target, ref); + const double reference = get_double_data(reference_value, tensor.data_type()); - ARM_COMPUTE_TEST_INFO("id = " << id); - ARM_COMPUTE_TEST_INFO("channel = " << channel); - ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << target); - ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << ref); - ARM_COMPUTE_EXPECT_EQUAL(target, ref, framework::LogLevel::DEBUG); - - if(!equal) + if(!compare<AbsoluteTolerance<double>, double>(target, reference)) { + ARM_COMPUTE_TEST_INFO("id = " << id); + ARM_COMPUTE_TEST_INFO("channel = " << channel); + ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << target); + ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << reference); + ARM_COMPUTE_EXPECT_EQUAL(target, reference, framework::LogLevel::DEBUG); + ++num_mismatches; } |