code: def on_device(
      body, device, constrain_result=False, constrain_body=True
  ):
      """Annotates a body expression with device constraints. The constraint influences
      how the body is compiled, where the body is evaluated, and where the result of
      evaluation is stored.
  
      Note that the defaults for the constrain_body and constrain_result parameters should
      almost never need to be overridden by the user. These parameters are exposed here
      to help unit tests exercise the PlanDevices pass machinery.
  
      Parameters
      ----------
      body : tvm.relay.Expr
          The expression to be annotated.
  
      device : Union[:py:class:`Device`, str]
          The device to annotate with.
  
      constrain_result  : bool
          If false (the default), the result of the on_device is not constrained to be on device.
  
      constrain_body : bool
          If true (the default), the body of the on_device is constrained to be on device.
  
      Returns
      -------
      result : tvm.relay.Expr
          The annotated expression.
      """
      return _make.OnDevice(
          body,
          _make_virtual_device(device),
          constrain_result,
          constrain_body,
      )
  
file_path: tvm/python/tvm/relay/op/annotation/annotation.py
imports: from tvm import target
  from tvm.runtime import ndarray
  from tvm.runtime import Device
  from .None import _make
  from ..None import op
label_desc: Use image node_id 2 for calling a global function with example usage: on_device(body, device, constrain_result, constrain_body) and returns: _make