loosen atol for tf < 1.1
+from distutils.version import LooseVersion
import unittest
import numpy as np
@@ -29,19 +30,23 @@ class TestMNISTTutorialTF(CleverHansTest):
self.assertGreater(report.train_adv_train_adv_eval, 0.4)
# Check that the tutorial is deterministic (seeded properly)
+ if LooseVersion(tf.__version__) >= LooseVersion('1.1.0'):
+ atol_fac = 1
+ else:
+ atol_fac = 2
report_2 = mnist_tutorial_tf.mnist_tutorial(**test_dataset_indices)
self.assertClose(report.train_clean_train_clean_eval,
report_2.train_clean_train_clean_eval,
- atol=5e-3)
+ atol=atol_fac * 5e-3)
self.assertClose(report.train_clean_train_adv_eval,
report_2.train_clean_train_adv_eval,
- atol=5e-3)
+ atol=atol_fac * 5e-3)
self.assertClose(report.train_adv_train_clean_eval,
report_2.train_adv_train_clean_eval,
- atol=2e-2)
+ atol=atol_fac * 2e-2)
self.assertClose(report.train_adv_train_adv_eval,
report_2.train_adv_train_adv_eval,
- atol=2e-1)
+ atol=atol_fac * 2e-1)
if __name__ == '__main__':
unittest.main()
