Skip to content

Commit 9e46394

Browse files
authored
Merge pull request #867 from onnx/gs/ir7-in-master
use same opset->ir mapping as in r1.5 branch
2 parents b39da4b + 852fbdf commit 9e46394

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

ci_build/azure_pipelines/templates/job_generator.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ parameters:
66
tf_versions: ['']
77
onnx_versions: ['']
88
onnx_opsets: ['11', '10', '9', '8', '7']
9-
onnx_backends: {onnxruntime: ['1.1.0']}
9+
onnx_backends: {onnxruntime: ['1.2.0']}
1010
job: {}
1111
run_setup: 'True'
1212
report_coverage: 'False'

tests/test_optimizers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import numpy as np
1111
from onnx import helper, TensorProto, OperatorSetIdProto
12-
from tf2onnx import utils
12+
from tf2onnx import utils, constants
1313
from tf2onnx.graph import GraphUtil
1414
from backend_test_base import Tf2OnnxBackendTestBase
1515
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):
6969
def make_model(self, graph, producer_name="onnx-tests"):
7070
imp = OperatorSetIdProto()
7171
imp.version = self.config.opset
72-
7372
model_proto = helper.make_model(graph, producer_name=producer_name, opset_imports=[imp])
73+
try:
74+
model_proto.ir_version = constants.OPSET_TO_IR_VERSION.get(self.config.opset, model_proto.ir_version)
75+
except: # pylint: disable=bare-except
76+
pass
7477
return model_proto
7578

7679
# Tranpose Optimizer Tests Start

tf2onnx/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
ENV_TF2ONNX_DEBUG_MODE = "TF2ONNX_DEBUG_MODE"
4040

4141
# Mapping opset to IR version.
42-
# When adding here, make sure that the IR changes don't impact that we do.
42+
# Note: opset 7 and opset 8 came out with IR3 but we need IR4 because of PlaceholderWithDefault
4343
OPSET_TO_IR_VERSION = {
44-
1: 3, 2: 3, 3: 3, 4: 4, 5: 3, 6: 3, 7: 3, 8: 4, 9: 4, 10: 5, 11: 6, 12: 7
44+
1: 3, 2: 3, 3: 3, 4: 3, 5: 3, 6: 3, 7: 4, 8: 4, 9: 4, 10: 5, 11: 6, 12: 7
4545
}

0 commit comments

Comments
 (0)