Skip to content

Commit

Permalink
Merge pull request #867 from onnx/gs/ir7-in-master
Browse files Browse the repository at this point in the history
use same opset->ir mapping as in r1.5 branch
  • Loading branch information
guschmue authored Apr 1, 2020
2 parents b39da4b + 852fbdf commit 9e46394
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ci_build/azure_pipelines/templates/job_generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 5 additions & 2 deletions tests/test_optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tf2onnx/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 9e46394

Please sign in to comment.