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

Upgrade op_version to pass onnx initializer checker #146

Merged
merged 3 commits into from
Sep 24, 2020
Merged
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
5 changes: 5 additions & 0 deletions onnxconverter_common/onnx_ex.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ def make_model_ex(graph, imported_opset_pairs, target_default_opset, metadata_pr
purified_operator_set = dict()
for op_domain, op_version in imported_opset_pairs:
if op_domain not in purified_operator_set:
if op_domain == '':
# Initializers are a subset of graph inputs for IR_VERSION <= 3 (target opset < 8).
# Need upgrade opv since initializers are separate for IR_VERSION >= 4 to pass onnx.checker.
if op_version < 8 and target_default_opset is not None and target_default_opset >= 8:
op_version = 8
purified_operator_set[op_domain] = op_version
else:
purified_operator_set[op_domain] = max(purified_operator_set[op_domain], op_version)
Expand Down