Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use same opset->ir mapping as in r1.5 branch #867

Merged
merged 2 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}