aboutsummaryrefslogtreecommitdiff
path: root/utils/Utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/Utils.h')
-rw-r--r--utils/Utils.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/utils/Utils.h b/utils/Utils.h
index 04ccc3e812..788ae4eeb7 100644
--- a/utils/Utils.h
+++ b/utils/Utils.h
@@ -782,15 +782,16 @@ void init_sgemm_output(T &dst, T &src0, T &src1, arm_compute::DataType dt)
*/
uint64_t get_mem_free_from_meminfo();
-/** Compare to tensor
+/** Compare two tensors
*
- * @param[in] tensor1 First tensor to be compared.
- * @param[in] tensor2 Second tensor to be compared.
+ * @param[in] tensor1 First tensor to be compared.
+ * @param[in] tensor2 Second tensor to be compared.
+ * @param[in] tolerance Tolerance used for the comparison.
*
* @return The number of mismatches
*/
template <typename T>
-int compare_tensor(ITensor &tensor1, ITensor &tensor2)
+int compare_tensor(ITensor &tensor1, ITensor &tensor2, T tolerance)
{
ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(&tensor1, &tensor2);
ARM_COMPUTE_ERROR_ON_MISMATCHING_SHAPES(&tensor1, &tensor2);
@@ -807,7 +808,7 @@ int compare_tensor(ITensor &tensor1, ITensor &tensor2)
execute_window_loop(window, [&](const Coordinates & id)
{
- if(std::abs(*reinterpret_cast<T *>(itensor1.ptr()) - *reinterpret_cast<T *>(itensor2.ptr())) > 0.0001)
+ if(std::abs(*reinterpret_cast<T *>(itensor1.ptr()) - *reinterpret_cast<T *>(itensor2.ptr())) > tolerance)
{
++num_mismatches;
}