Raise diff tolerance value for TFViTMAEModelTest (#16483)

* Raise diff tolerance value

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
Yih-Dar 2022-03-29 22:12:27 +02:00 committed by GitHub
parent ee18d4d2a9
commit 2b483230a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -427,7 +427,9 @@ class TFViTMAEModelTest(TFModelTesterMixin, unittest.TestCase):
tf_outputs[pt_nans] = 0
max_diff = np.amax(np.abs(tf_outputs - pt_outputs))
self.assertLessEqual(max_diff, 1e-5)
# Set a higher tolerance (2e-5) here than the one in the common test (1e-5).
# TODO: A deeper look to decide the best (common) tolerance for the test to be strict but not too flaky.
self.assertLessEqual(max_diff, 2e-5)
else:
raise ValueError(
f"`tf_outputs` should be a `tuple` or an instance of `tf.Tensor`. Got {type(tf_outputs)} instead."