code: def extract_constants(func):
      """Extract the constants from a function and replace them with
      Vars so the function can be lowered to a TE graph. Additionally
      returns all the values of the constants extracted.
  
      Parameters
      ----------
      func : tvm.relay.Function
          The Relay function from which to extract constants.
  
      Returns
      -------
      new_func : tvm.relay.Function
          The Relay function with constants replaced by vars.
      const_dict : dict of int to numpy.ndarray
          A dict of the extracted constants keyed by their param index.
  
      """
      const_dict = {}
      params = len(func.params)
      new_func, consts = ExtractConstants().extract_constants(func)
      for i, const in enumerate(consts):
          const_dict[params + i] = const
  
      new_func = tvm.relay.transform.InferType()(
          tvm.IRModule.from_expr(new_func)
      )["main"]
      return new_func, const_dict
  
imports: import tvm
  from tvm import relay
  from tvm.driver.build_module import schedule_to_module
  from tvm.relay.backend.contrib.ethosu import vela_api
  from tvm.relay.expr_functor import ExprMutator
  from ..None import util
  from .None import passes
  from .scheduler import schedule
label_desc: Use image node_id 3 for calling a global function with example usage: extract_constants(func) and returns: new_func,  const_dict