Skip to content
Snippets Groups Projects
Commit 1cf7e529 authored by Neta Zmora's avatar Neta Zmora
Browse files

add tolerance (=0.05) when comparing test results

Small variances can occur when using different cudnn versions,
even when the environment and distiller version is the same.
parent f92656c7
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,7 @@ import re ...@@ -21,6 +21,7 @@ import re
from collections import namedtuple from collections import namedtuple
import argparse import argparse
import time import time
import math
DS_CIFAR = 'cifar10' DS_CIFAR = 'cifar10'
DS_MNIST = 'mnist' DS_MNIST = 'mnist'
...@@ -78,13 +79,13 @@ def success(string): ...@@ -78,13 +79,13 @@ def success(string):
# Checkers # Checkers
########### ###########
def compare_values(name, expected, actual): def compare_values(name, expected, actual, rel_tol=5e-2):
print('Comparing {0}: Expected = {1} ; Actual = {2}'.format(name, expected, actual)) print('Comparing {0}: Expected = {1} ; Actual = {2}'.format(name, expected, actual))
if expected != actual: if math.isclose(expected, actual, rel_tol=rel_tol):
return True
else:
error('Mismatch on {0}'.format(name)) error('Mismatch on {0}'.format(name))
return False return False
else:
return True
def accuracy_checker(log, run_dir, expected_results): def accuracy_checker(log, run_dir, expected_results):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment