Fix false positives in ModelRunner. (#1541)

This commit is contained in:
Adam Osewski 2020-07-30 13:26:19 +02:00 committed by GitHub
parent 0f62031991
commit fc5d8c75d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,6 +26,7 @@ from onnx import numpy_helper, NodeProto, ModelProto
from onnx.backend.base import Backend, BackendRep from onnx.backend.base import Backend, BackendRep
from onnx.backend.test.case.test_case import TestCase as OnnxTestCase from onnx.backend.test.case.test_case import TestCase as OnnxTestCase
from onnx.backend.test.runner import TestItem from onnx.backend.test.runner import TestItem
from tests.test_onnx.utils.onnx_helpers import import_onnx_model
from typing import Any, Dict, List, Optional, Pattern, Set, Text, Type, Union from typing import Any, Dict, List, Optional, Pattern, Set, Text, Type, Union
@ -75,11 +76,7 @@ class ModelImportRunner(onnx.backend.test.BackendTest):
def run_import(test_self: Any, device: Text) -> None: def run_import(test_self: Any, device: Text) -> None:
model = ModelImportRunner._load_onnx_model(model_test.model_dir, model_test.model) model = ModelImportRunner._load_onnx_model(model_test.model_dir, model_test.model)
model_marker[0] = model model_marker[0] = model
if not hasattr(self.backend, "is_compatible") and not callable( assert import_onnx_model(model)
self.backend.is_compatible
):
raise unittest.SkipTest("Provided backend does not provide is_compatible method")
self.backend.is_compatible(model)
self._add_test(kind + "ModelImport", model_test.name, run_import, model_marker) self._add_test(kind + "ModelImport", model_test.name, run_import, model_marker)