From fb6f0910739f9aefd3c3b7aaf9a8d182f210e11e Mon Sep 17 00:00:00 2001 From: Scott McKay Date: Fri, 8 Mar 2019 14:51:13 -0800 Subject: [PATCH] Create derived class from onnx BackendTest so we can use the same tolerance values as in onnx_test_runner. Enable GRU test that was failing. (#584) --- .../test/python/onnx_backend_test_series.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/onnxruntime/test/python/onnx_backend_test_series.py b/onnxruntime/test/python/onnx_backend_test_series.py index 9469f82b17..2f2f16afc9 100644 --- a/onnxruntime/test/python/onnx_backend_test_series.py +++ b/onnxruntime/test/python/onnx_backend_test_series.py @@ -10,12 +10,22 @@ import onnxruntime.backend as c2 pytest_plugins = 'onnx.backend.test.report', -backend_test = onnx.backend.test.BackendTest(c2, __name__) +class OrtBackendTest(onnx.backend.test.BackendTest): + def __init__(self, backend, parent_module=None): + super(OrtBackendTest, self).__init__(backend, parent_module) + + @classmethod + def assert_similar_outputs(cls, ref_outputs, outputs, rtol, atol): + # type: (Sequence[Any], Sequence[Any], float, float) -> None + + # override the rtol and atol values to match onnx_test_runner tolerances + super(OrtBackendTest, cls).assert_similar_outputs(ref_outputs, outputs, 1e-3, 1e-5) + +backend_test = OrtBackendTest(c2, __name__) # Type not supported backend_test.exclude(r'(FLOAT16)') -backend_test.exclude(r'^test_gru_seq_length_cpu.*') backend_test.exclude(r'(' '^test_cast_DOUBLE_to_FLOAT_cpu.*'