aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/Validation.h
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2018-02-26 15:22:16 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:48:12 +0000
commitff6c260a65a1341e96e5cbf60dc492172530002f (patch)
tree5474cebfbdca3dfa3d9904193f3a804009c7d477 /tests/validation/Validation.h
parent88627fbe2502018f6a93fcfc686b5a7f2d54a2a9 (diff)
downloadComputeLibrary-ff6c260a65a1341e96e5cbf60dc492172530002f.tar.gz
COMPMID-945: Fix GEMM CL FP32 mismatch - V2
The approach used in e415fc13 was not correct. Switch to allowing to use an absolute tolerance if the relative tolerance comparison fails. Change-Id: I8d94d2f8edd3e0eb7388d3d8ac3ebfc37790e267 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/122269 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/Validation.h')
-rw-r--r--tests/validation/Validation.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/tests/validation/Validation.h b/tests/validation/Validation.h
index 651b7e5b3c..506318018d 100644
--- a/tests/validation/Validation.h
+++ b/tests/validation/Validation.h
@@ -180,7 +180,7 @@ void validate(const arm_compute::PaddingSize &padding, const arm_compute::Paddin
* other test cases.
*/
template <typename T, typename U = AbsoluteTolerance<T>>
-void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, U tolerance_value = U(), float tolerance_number = 0.f);
+void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, U tolerance_value = U(), float tolerance_number = 0.f, float absolute_tolerance_value = 0.f);
/** Validate tensors with valid region.
*
@@ -193,7 +193,7 @@ void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, U toler
* other test cases.
*/
template <typename T, typename U = AbsoluteTolerance<T>>
-void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value = U(), float tolerance_number = 0.f);
+void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value = U(), float tolerance_number = 0.f, float absolute_tolerance_value = 0.f);
/** Validate tensors with valid mask.
*
@@ -206,7 +206,8 @@ void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const V
* other test cases.
*/
template <typename T, typename U = AbsoluteTolerance<T>>
-void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const SimpleTensor<T> &valid_mask, U tolerance_value = U(), float tolerance_number = 0.f);
+void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const SimpleTensor<T> &valid_mask, U tolerance_value = U(), float tolerance_number = 0.f,
+ float absolute_tolerance_value = 0.f);
/** Validate tensors against constant value.
*
@@ -317,10 +318,10 @@ struct compare<RelativeTolerance<U>> : public compare_base<RelativeTolerance<U>>
};
template <typename T, typename U>
-void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, U tolerance_value, float tolerance_number)
+void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, U tolerance_value, float tolerance_number, float absolute_tolerance_value)
{
// Validate with valid region covering the entire shape
- validate(tensor, reference, shape_to_valid_region(tensor.shape()), tolerance_value, tolerance_number);
+ validate(tensor, reference, shape_to_valid_region(tensor.shape()), tolerance_value, tolerance_number, absolute_tolerance_value);
}
template <typename T, typename U, typename = typename std::enable_if<std::is_integral<T>::value>::type>
@@ -331,7 +332,7 @@ void validate_wrap(const IAccessor &tensor, const SimpleTensor<T> &reference, U
}
template <typename T, typename U>
-void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value, float tolerance_number)
+void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value, float tolerance_number, float absolute_tolerance_value)
{
int64_t num_mismatches = 0;
int64_t num_elements = 0;
@@ -365,6 +366,14 @@ void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const V
if(!compare<U>(target_value, reference_value, tolerance_value))
{
+ if(absolute_tolerance_value != 0.f)
+ {
+ const AbsoluteTolerance<float> abs_tolerance(absolute_tolerance_value);
+ if(compare<AbsoluteTolerance<float>>(target_value, reference_value, abs_tolerance))
+ {
+ continue;
+ }
+ }
ARM_COMPUTE_TEST_INFO("id = " << id);
ARM_COMPUTE_TEST_INFO("channel = " << c);
ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << framework::make_printable(target_value));
@@ -474,7 +483,7 @@ void validate_wrap(const IAccessor &tensor, const SimpleTensor<T> &reference, co
}
template <typename T, typename U>
-void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const SimpleTensor<T> &valid_mask, U tolerance_value, float tolerance_number)
+void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const SimpleTensor<T> &valid_mask, U tolerance_value, float tolerance_number, float absolute_tolerance_value)
{
int64_t num_mismatches = 0;
int64_t num_elements = 0;
@@ -508,6 +517,14 @@ void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const S
if(!compare<U>(target_value, reference_value, tolerance_value))
{
+ if(absolute_tolerance_value != 0.f)
+ {
+ const AbsoluteTolerance<float> abs_tolerance(absolute_tolerance_value);
+ if(compare<AbsoluteTolerance<float>>(target_value, reference_value, abs_tolerance))
+ {
+ continue;
+ }
+ }
ARM_COMPUTE_TEST_INFO("id = " << id);
ARM_COMPUTE_TEST_INFO("channel = " << c);
ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << framework::make_printable(target_value));