diff --git a/debug/accuracy_tools/api_accuracy_checker/compare/algorithm.py b/debug/accuracy_tools/api_accuracy_checker/compare/algorithm.py index b495a53160f4da5ff1d94d7e7998b7d3374d35a5..2d4cfea38bd12044a8db7bf33fe107222c29bbda 100644 --- a/debug/accuracy_tools/api_accuracy_checker/compare/algorithm.py +++ b/debug/accuracy_tools/api_accuracy_checker/compare/algorithm.py @@ -54,6 +54,8 @@ def cosine_sim(cpu_output, npu_output): return get_max_rel_err(n_value, b_value) if n_value.dtype == np.uint8: return compare_uint8_data(n_value, b_value) + n_value = n_value / (np.max(np.abs(n_value)) + np.finfo(n_value.dtype).eps) + b_value = b_value / (np.max(np.abs(b_value)) + np.finfo(b_value.dtype).eps) num = n_value.dot(b_value) a_norm = np.linalg.norm(n_value) b_norm = np.linalg.norm(b_value)