Skip to content
This repository has been archived by the owner on Nov 25, 2022. It is now read-only.

Commit

Permalink
[ONNX] Handle multiple imports (apache#13065)
Browse files Browse the repository at this point in the history
* onnx get right import

* fixins
  • Loading branch information
AndrewZhaoLuo authored and liuxinwei committed Nov 10, 2022
1 parent 9246a2b commit a0e3582
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion python/tvm/relay/frontend/onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -5906,7 +5906,16 @@ def from_onnx(
graph = model.graph

try:
opset_in_model = model.opset_import[0].version if model.opset_import else 1
opset_in_model = 1
if model.opset_import:
# TODO: for now we only really support ai.onnx op set
# TODO: handle other namespaces well see https://github.com/apache/tvm/issues/10950
for opset_identifier in model.opset_import:
# As per https://github.com/onnx/onnx/blob/main/docs/IR.md
# All operator sets except the default one must specify the operator version
if str(opset_identifier.domain) in ["ai.onnx", ""]:
opset_in_model = opset_identifier.version
break
except AttributeError:
opset_in_model = 1

Expand Down

0 comments on commit a0e3582

Please sign in to comment.