From 870d8efcd304616b0544ca1d9b519f8726d3e5f3 Mon Sep 17 00:00:00 2001 From: Vasilis Vryniotis Date: Mon, 8 Aug 2022 11:05:11 +0100 Subject: [PATCH 1/3] Make test precision stricter for Classification --- test/test_models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_models.py b/test/test_models.py index 5ab0640a70e..6c37d5c8e69 100644 --- a/test/test_models.py +++ b/test/test_models.py @@ -614,7 +614,7 @@ def test_classification_model(model_fn, dev): # RNG always on CPU, to ensure x in cuda tests is bitwise identical to x in cpu tests x = torch.rand(input_shape).to(device=dev) out = model(x) - _assert_expected(out.cpu(), model_name, prec=0.1) + _assert_expected(out.cpu(), model_name, prec=1e-5) assert out.shape[-1] == num_classes _check_jit_scriptable(model, (x,), unwrapper=script_model_unwrapper.get(model_name, None), eager_out=out) _check_fx_compatible(model, x, eager_out=out) @@ -841,7 +841,7 @@ def test_video_model(model_fn, dev): # RNG always on CPU, to ensure x in cuda tests is bitwise identical to x in cpu tests x = torch.rand(input_shape).to(device=dev) out = model(x) - _assert_expected(out.cpu(), model_name, prec=0.1) + _assert_expected(out.cpu(), model_name, prec=1e-5) assert out.shape[-1] == num_classes _check_jit_scriptable(model, (x,), unwrapper=script_model_unwrapper.get(model_name, None), eager_out=out) _check_fx_compatible(model, x, eager_out=out) @@ -884,7 +884,7 @@ def test_quantized_classification_model(model_fn): out = model(x) if model_name not in quantized_flaky_models: - _assert_expected(out, model_name + "_quantized", prec=0.1) + _assert_expected(out, model_name + "_quantized", prec=1e-3) assert out.shape[-1] == 5 _check_jit_scriptable(model, (x,), unwrapper=script_model_unwrapper.get(model_name, None), eager_out=out) _check_fx_compatible(model, x, eager_out=out) From a4b593065f9dac6847ea8cc9e16b8abba447a5a1 Mon Sep 17 00:00:00 2001 From: Vasilis Vryniotis Date: Mon, 8 Aug 2022 11:19:05 +0100 Subject: [PATCH 2/3] Update classification threshold. --- test/test_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_models.py b/test/test_models.py index 6c37d5c8e69..1d13bf21b05 100644 --- a/test/test_models.py +++ b/test/test_models.py @@ -614,7 +614,7 @@ def test_classification_model(model_fn, dev): # RNG always on CPU, to ensure x in cuda tests is bitwise identical to x in cpu tests x = torch.rand(input_shape).to(device=dev) out = model(x) - _assert_expected(out.cpu(), model_name, prec=1e-5) + _assert_expected(out.cpu(), model_name, prec=1e-3) assert out.shape[-1] == num_classes _check_jit_scriptable(model, (x,), unwrapper=script_model_unwrapper.get(model_name, None), eager_out=out) _check_fx_compatible(model, x, eager_out=out) From dd9504a2d1525b86fb1c6a68fae4f9e795dadffc Mon Sep 17 00:00:00 2001 From: Vasilis Vryniotis Date: Mon, 8 Aug 2022 11:30:43 +0100 Subject: [PATCH 3/3] Update quantized classification threshold. --- test/test_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_models.py b/test/test_models.py index 1d13bf21b05..bc83874ee4f 100644 --- a/test/test_models.py +++ b/test/test_models.py @@ -884,7 +884,7 @@ def test_quantized_classification_model(model_fn): out = model(x) if model_name not in quantized_flaky_models: - _assert_expected(out, model_name + "_quantized", prec=1e-3) + _assert_expected(out, model_name + "_quantized", prec=2e-2) assert out.shape[-1] == 5 _check_jit_scriptable(model, (x,), unwrapper=script_model_unwrapper.get(model_name, None), eager_out=out) _check_fx_compatible(model, x, eager_out=out)