added absolute tolerance to handle comparing zeros

This commit is contained in:
lameeus
2017-11-20 11:46:24 +01:00
parent a1079c012a
commit 68acf5e2ee
+3 -2
View File
@@ -157,8 +157,9 @@ class TestBackend(object):
th_var_val = KTH.eval(th_var)
tf_var_val = KTF.eval(tf_var)
assert_allclose(th_mean_val, tf_mean_val, rtol=1e-4)
assert_allclose(th_var_val, tf_var_val, rtol=1e-4)
# absolute tolerance needed when working with zeros
assert_allclose(th_mean_val, tf_mean_val, rtol=1e-4, atol=1e-10)
assert_allclose(th_var_val, tf_var_val, rtol=1e-4, atol=1e-10)
def test_clip(self):
check_single_tensor_operation('clip', (4, 2), min_value=0.4, max_value=0.6)