class_docstr: Relay VM runtime.
  
  Parameters
  ----------
  exe : Executable
      The VM executable.
  
  device : tvm.runtime.Device or List[tvm.runtime.Device]
      The device(s) on which the model will run.
      Currently at most one device per device type is supported.
  
  memory_cfg : str or Dict[tvm.runtime.Device, str], optional
      Config the type of memory allocator. The allocator type can be ["naive",
      "pooled"]. If memory_cfg is None, all devices will use pooled allocator
      by default. If memory_cfg is string, all devices will use the specified
      allocator type. If memory_cfg is a dict, each device uses the allocator
      type specified in the dict, or pooled allocator if not specified in the
      dict.
docstr: Construct a VirtualMachine wrapper class which provides a simple
  interface over the raw C++ Module based API.
  
  Parameters
  ----------
  exe: Union[Executable, Module]
      The executable either with the wrapper Python type or the raw runtime.Module.
  
      In most cases this will be the Python wrapper class tvm.runtime.vm.Executable but
      if you instead get the underlying runtime.Module subclass (i.e `exe.mod`) you
      can directly pass it to this method.
  
      This case can occur when doing things such as RPC where TVM's module APIs
      return the raw modules, not the wrapped modules. This constructor will
      handle this internally.
  
  device: Union[Device, List[Device]]
      The device, or devices on which to execute the VM code.
  
  memory_cfg: Optional[str]
      The allocator behavior to use for the VM.
  
  Returns
  -------
  vm: VirtualMachine
      A VM wrapper object.
docstr_tok: ["Construct","a","VirtualMachine","wrapper","class","which","provides","a","simple","interface","over","the","raw","C++","Module","based","API",".","Parameters","--","--","--","--","--","exe",":","Union","[","Executable",",","Module","]","The","executable","either","with","the","wrapper","Python","type","or","the","raw","runtime.Module",".","In","most","cases","this","will","be","the","Python","wrapper","class","tvm.runtime.vm.Executable","but","if","you","instead","get","the","underlying","runtime.Module","subclass","(","i.e","`","exe.mod","`",")","you","can","directly","pass","it","to","this","method",".","This","case","can","occur","when","doing","things","such","as","RPC","where","TVM","'s","module","APIs","return","the","raw","modules",",","not","the","wrapped","modules",".","This","constructor","will","handle","this","internally",".","device",":","Union","[","Device",",","List","[","Device","]","]","The","device",",","or","devices","on","which","to","execute","the","VM","code",".","memory_cfg",":","Optional","[","str","]","The","allocator","behavior","to","use","for","the","VM",".","Returns","--","--","--","-","vm",":","VirtualMachine","A","VM","wrapper","object","."]
code: def __init__(self, exe, device, memory_cfg=None):
      """
      Construct a VirtualMachine wrapper class which provides a simple
      interface over the raw C++ Module based API.
  
      Parameters
      ----------
      exe: Union[Executable, Module]
          The executable either with the wrapper Python type or the raw runtime.Module.
  
          In most cases this will be the Python wrapper class tvm.runtime.vm.Executable but
          if you instead get the underlying runtime.Module subclass (i.e `exe.mod`) you
          can directly pass it to this method.
  
          This case can occur when doing things such as RPC where TVM's module APIs
          return the raw modules, not the wrapped modules. This constructor will
          handle this internally.
  
      device: Union[Device, List[Device]]
          The device, or devices on which to execute the VM code.
  
      memory_cfg: Optional[str]
          The allocator behavior to use for the VM.
  
      Returns
      -------
      vm: VirtualMachine
          A VM wrapper object.
      """
      if not isinstance(exe, Executable) and not isinstance(
          exe, Module
      ):
          raise TypeError(
              f"exe is expected to be the type of Executable, but received {type(exe)}"
          )
  
      if not isinstance(exe, Executable):
          exe = Executable(exe)
  
      self.module = exe.mod["vm_load_executable"]()
      self._exec = exe
      self._init = self.module["init"]
      self._invoke = self.module["invoke"]
      self._invoke_stateful = self.module["invoke_stateful"]
      self._get_output = self.module["get_output"]
      self._get_num_outputs = self.module["get_num_outputs"]
      self._get_input_index = self.module["get_input_index"]
      self._set_input = self.module["set_input"]
      self._set_one_input = self.module["set_one_input"]
      self._set_outputs = self.module["set_outputs"]
      self._setup_device(device, memory_cfg)
  
imports: import numpy
  import tvm
  from tvm.runtime import Module
  from tvm._ffi.runtime_ctypes import TVMByteArray
  from tvm._ffi import base
  from .object import Object
  from .None import _ffi_api, container
  from ..rpc.base import RPC_SESS_MASK
label_desc: Use image node_id 1 to create a new VirtualMachine object from inherited base classes: object with example: obj = VirtualMachine(exe, device, memory_cfg)