code: def to_mxnet_func(func, const_loc=None):
      """Wrap a TVM function as MXNet function
  
      MXNet function runs asynchrously via its engine.
  
      Parameters
      ----------
      func : Function
          A TVM function that can take positional arguments
  
      const_loc : list of int
          List of integers indicating the argument position
          of read only NDArray argument.
          The NDArray argument location that are not annotated
          will be viewed as mutable arrays in MXNet's engine.
  
      Returns
      -------
      async_func : Function
          A function that can take MXNet NDArray as argument
          in places that used to expect TVM NDArray.
          Run asynchrously in MXNet's async engine.
      """
      # only import mxnet when wrap get called.
      # pylint: disable=import-self, import-outside-toplevel
      import mxnet
  
      if isinstance(func, Module):
          func = func.entry_func
  
      def _get_bridge_func():
          """Get MXNet bridge function"""
          if not mxnet.base._LIB.MXTVMBridge:
              raise RuntimeError(
                  "MXTVMBridge not exist in mxnet package,"
                  " please update to latest version"
              )
  
          fdict = tvm._ffi.registry.extract_ext_funcs(
              mxnet.base._LIB.MXTVMBridge
          )
          ret = fdict["WrapAsyncCall"]
          ret.is_global = True
          return ret
  
      global _wrap_async
  
      if _wrap_async is None:
          # Register extension type in first time
          _wrap_async = _get_bridge_func()
          tvm._ffi.registry.register_extension(mxnet.nd.NDArray)
  
      const_loc = const_loc if const_loc else []
      return _wrap_async(
          func,
          tvm.runtime._ffi_api.TVMSetStream,
          len(const_loc),
          *const_loc,
      )
  
imports: from __future__ import absolute_import
  import tvm._ffi.registry
  import tvm.runtime._ffi_api
  from tvm.runtime import Module
label_desc: Use image node_id 1 for calling a global function with example usage: to_mxnet_func(func, const_loc) and returns: _wrap_async, ret