import tvm.runtime.vm as vm_rt
from tvm import autotvm
from tvm.relay import expr as _expr
+from tvm.relay.ty import type_has_any
from tvm.relay.backend.interpreter import Executor
from . import _vm
def _vm_wrapper(*args, **kwargs):
args = self._convert_args(main, args, kwargs)
+ ret_type = self.mod["main"].checked_type.ret_type
+ if type_has_any(ret_type) and "llvm" not in str(self.target) and "arm" not in str(
+ self.target):
+ raise ValueError(
+ "Virtual Machine only supports dynamic graphs on CPU, got output type",
+ ret_type, "on target", self.target)
return self.vm.run(*args)
return _vm_wrapper
if expr:
self.mod["main"] = expr
ret_type = self.mod["main"].checked_type.ret_type
+ if _ty.type_has_any(ret_type):
+ raise ValueError("Graph Runtime only supports static graphs, got output type",
+ ret_type)
num_outputs = len(ret_type.fields) if isinstance(ret_type, _ty.TupleType) else 1
graph_json, mod, params = build(self.mod, target=self.target)
gmodule = _graph_rt.create(graph_json, mod, self.ctx)