kazum commented on a change in pull request #5073: [Relay][Frontend][ONNX]
operator support NonZero
URL: https://github.com/apache/incubator-tvm/pull/5073#discussion_r393506803
##########
File path: tests/python/frontend/onnx/test_forward.py
##########
@@ -30,6 +30,30 @@
import scipy
+def get_tvm_output_with_vm(graph_def, input_data, target, ctx,
+ opset=None, mode=None):
+ """ Generic function to execute and get tvm output with vm executor"""
+ if isinstance(input_data, list):
+ input_names = {}
+ shape_dict = {}
+ dtype_dict = {}
+ for i, _ in enumerate(input_data):
+ input_names[i] = graph_def.graph.input[i].name
+ shape_dict[input_names[i]] = input_data[i].shape
+ dtype_dict[input_names[i]] = input_data[i].dtype
+ else:
+ input_names = graph_def.graph.input[0].name
+ shape_dict = {input_names: input_data.shape}
+ dtype_dict = {input_names: input_data.dtype}
+
+ mod, params = relay.frontend.from_onnx(graph_def, shape_dict, opset=opset)
+
+ ex = relay.create_executor(mode, mod=mod, ctx=tvm.cpu(), target=target)
Review comment:
`tvm.cpu()` should be `ctx`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services