From 4fe7a90b6be2ad98853e35be0f9594949ea34cb0 Mon Sep 17 00:00:00 2001 From: Guenther Schmuelling Date: Wed, 1 Apr 2020 11:09:35 -0700 Subject: [PATCH 1/2] use the same mapping from opset to ir as in r1.5 branch --- tests/test_optimizers.py | 7 +++++-- tf2onnx/constants.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test_optimizers.py b/tests/test_optimizers.py index 10147b40d..2f7d29790 100644 --- a/tests/test_optimizers.py +++ b/tests/test_optimizers.py @@ -9,7 +9,7 @@ import numpy as np from onnx import helper, TensorProto, OperatorSetIdProto -from tf2onnx import utils +from tf2onnx import utils, constants from tf2onnx.graph import GraphUtil from backend_test_base import Tf2OnnxBackendTestBase from common import unittest_main, group_nodes_by_type, check_opset_min_version, check_opset_max_version @@ -69,8 +69,11 @@ def _make_onnx_const(np_val, output_name): def make_model(self, graph, producer_name="onnx-tests"): imp = OperatorSetIdProto() imp.version = self.config.opset - model_proto = helper.make_model(graph, producer_name=producer_name, opset_imports=[imp]) + try: + model_proto.ir_version = constants.OPSET_TO_IR_VERSION.get(self.config.opset, model_proto.ir_version) + except: # pylint: disable=bare-except + pass return model_proto # Tranpose Optimizer Tests Start diff --git a/tf2onnx/constants.py b/tf2onnx/constants.py index b942565d5..a5b0e8828 100644 --- a/tf2onnx/constants.py +++ b/tf2onnx/constants.py @@ -39,7 +39,7 @@ ENV_TF2ONNX_DEBUG_MODE = "TF2ONNX_DEBUG_MODE" # Mapping opset to IR version. -# When adding here, make sure that the IR changes don't impact that we do. +# Note: opset 7 and opset 8 came out with IR3 but we need IR4 because of PlaceholderWithDefault OPSET_TO_IR_VERSION = { - 1: 3, 2: 3, 3: 3, 4: 4, 5: 3, 6: 3, 7: 3, 8: 4, 9: 4, 10: 5, 11: 6, 12: 7 + 1: 3, 2: 3, 3: 3, 4: 3, 5: 3, 6: 3, 7: 4, 8: 4, 9: 4, 10: 5, 11: 6, 12: 7 } From 852fbdf9f2482557dd9ac192d6f24941c19ae69b Mon Sep 17 00:00:00 2001 From: Guenther Schmuelling Date: Wed, 1 Apr 2020 11:10:31 -0700 Subject: [PATCH 2/2] use ort-1.2 --- ci_build/azure_pipelines/templates/job_generator.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci_build/azure_pipelines/templates/job_generator.yml b/ci_build/azure_pipelines/templates/job_generator.yml index 8da738ff9..cc6950ef7 100644 --- a/ci_build/azure_pipelines/templates/job_generator.yml +++ b/ci_build/azure_pipelines/templates/job_generator.yml @@ -6,7 +6,7 @@ parameters: tf_versions: [''] onnx_versions: [''] onnx_opsets: ['11', '10', '9', '8', '7'] - onnx_backends: {onnxruntime: ['1.1.0']} + onnx_backends: {onnxruntime: ['1.2.0']} job: {} run_setup: 'True' report_coverage: 'False'