Skip to content

Commit 76ae2dc

Browse files
markrogersjrtqchen
authored andcommitted
Get list of unsupported ONNX operators (#2995)
1 parent c779456 commit 76ae2dc

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

nnvm/python/nnvm/frontend/onnx.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,19 @@ def from_onnx(self, graph, opset):
830830
else:
831831
self._num_input += 1
832832
self._nodes[i_name] = _sym.Variable(name=i_name)
833+
# get list of unsupported ops
834+
convert_map = _get_convert_map(opset)
835+
unsupported_ops = set()
836+
for node in graph.node:
837+
op_name = node.op_type
838+
if op_name not in convert_map and \
839+
op_name != 'Constant' and \
840+
op_name not in _identity_list:
841+
unsupported_ops.add(op_name)
842+
if unsupported_ops:
843+
msg = 'The following operators are not supported for frontend ONNX: '
844+
msg += ', '.join(unsupported_ops)
845+
raise tvm.error.OpNotImplemented(msg)
833846
# construct nodes, nodes are stored as directed acyclic graph
834847
for node in graph.node:
835848
op_name = node.op_type

python/tvm/relay/frontend/onnx.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,19 @@ def from_onnx(self, graph, opset):
989989
else:
990990
dtype = d_type
991991
self._nodes[i_name] = new_var(i_name, shape=tshape, dtype=dtype)
992+
# get list of unsupported ops
993+
convert_map = _get_convert_map(opset)
994+
unsupported_ops = set()
995+
for node in graph.node:
996+
op_name = node.op_type
997+
if op_name not in convert_map and \
998+
op_name != 'Constant' and \
999+
op_name not in _identity_list:
1000+
unsupported_ops.add(op_name)
1001+
if unsupported_ops:
1002+
msg = 'The following operators are not supported for frontend ONNX: '
1003+
msg += ', '.join(unsupported_ops)
1004+
raise tvm.error.OpNotImplemented(msg)
9921005
# construct nodes, nodes are stored as directed acyclic graph
9931006
for node in graph.node:
9941007
op_name = node.op_type

0 commit comments

Comments
 (0)