From 76ae2dc6cbba7bfeaf4c3e9c8fba2f5e0ddefbac Mon Sep 17 00:00:00 2001 From: Mark Rogers Date: Wed, 15 May 2019 20:26:24 -0700 Subject: [PATCH] Get list of unsupported ONNX operators (#2995) --- nnvm/python/nnvm/frontend/onnx.py | 13 +++++++++++++ python/tvm/relay/frontend/onnx.py | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/nnvm/python/nnvm/frontend/onnx.py b/nnvm/python/nnvm/frontend/onnx.py index eb78b78..2434fb0 100644 --- a/nnvm/python/nnvm/frontend/onnx.py +++ b/nnvm/python/nnvm/frontend/onnx.py @@ -830,6 +830,19 @@ class GraphProto(object): else: self._num_input += 1 self._nodes[i_name] = _sym.Variable(name=i_name) + # get list of unsupported ops + convert_map = _get_convert_map(opset) + unsupported_ops = set() + for node in graph.node: + op_name = node.op_type + if op_name not in convert_map and \ + op_name != 'Constant' and \ + op_name not in _identity_list: + unsupported_ops.add(op_name) + if unsupported_ops: + msg = 'The following operators are not supported for frontend ONNX: ' + msg += ', '.join(unsupported_ops) + raise tvm.error.OpNotImplemented(msg) # construct nodes, nodes are stored as directed acyclic graph for node in graph.node: op_name = node.op_type diff --git a/python/tvm/relay/frontend/onnx.py b/python/tvm/relay/frontend/onnx.py index 08a64c3..470f419 100644 --- a/python/tvm/relay/frontend/onnx.py +++ b/python/tvm/relay/frontend/onnx.py @@ -989,6 +989,19 @@ class GraphProto(object): else: dtype = d_type self._nodes[i_name] = new_var(i_name, shape=tshape, dtype=dtype) + # get list of unsupported ops + convert_map = _get_convert_map(opset) + unsupported_ops = set() + for node in graph.node: + op_name = node.op_type + if op_name not in convert_map and \ + op_name != 'Constant' and \ + op_name not in _identity_list: + unsupported_ops.add(op_name) + if unsupported_ops: + msg = 'The following operators are not supported for frontend ONNX: ' + msg += ', '.join(unsupported_ops) + raise tvm.error.OpNotImplemented(msg) # construct nodes, nodes are stored as directed acyclic graph for node in graph.node: op_name = node.op_type -- 2.7.4