code: def lower_ethosu(sch, args, const_dict, name="main"):
      """Lower a schedule to TIR for the Arm(R) Ethos(TM)-U NPU target.
  
      The resulting TIR module will contain a single function
      that consists of a sequence of tir.call_extern to NPU
      operations.
  
      Parameters
      ----------
      sch : tvm.te.Schedule
          The schedule to be lowered.
      args : Union[list of tvm.te.Tensor, TEGraph]
          The input/output tensors.
      const_dict : dict of int to numpy.ndarray
          The constant dictionary.
      name : str, optional
          The name of the lowered primitive function.
  
      Returns
      -------
      mod : tvm.IRModule
          The lowered TIR module.
      const_dict : dict of int to numpy.ndarray
          The modified constant dictionary.
  
      """
      if not isinstance(args, list):
          args = list(args.inputs) + list(args.outputs)
      # config setup
      curr_pass_ctx = tvm.ir.transform.PassContext.current()
      curr_cfg = dict()
      for key, value in curr_pass_ctx.config.items():
          curr_cfg[key] = value
      tir_compiler_cfg = {
          "tir.LoopPartition": {
              "partition_const_loop": True,
              "no_unroll_loop_with_extent_one": True,
          },
          "tir.UnrollLoop": {"auto_max_depth": -1},
          "tir.noalias": True,
          "tir.debug_keep_trivial_loop": True,
      }
      # Merge two configs
      curr_cfg = {**curr_cfg, **tir_compiler_cfg}
  
      sch = sch.normalize()
  
      with tvm.transform.PassContext(config=curr_cfg):
          mod = schedule_to_module(sch, args, name)
  
          mod = tvm.tir.transform.Simplify()(mod)
          mod = ethosu_passes.RemoveConcatenates()(mod)
          mod = tvm.tir.transform.InjectRollingBuffer()(mod)
          mod = tvm.tir.transform.StorageFlatten(64)(mod)
          mod = tvm.tir.transform.UnrollLoop()(mod)
          mod = tvm.tir.transform.Simplify()(mod)
          mod = tvm.tir.transform.LoopPartition()(mod)
          mod = ethosu_passes.RemoveZeroStores()(mod)
          mod = tvm.tir.transform.Simplify()(mod)
          mod = tvm.tir.transform.RemoveNoOp()(mod)
          mod = ethosu_passes.ReplaceOperators()(mod)
          mod = tvm.tir.transform.RemoveNoOp()(mod)
          mod, const_dict = ethosu_passes.EncodeConstants(const_dict)(
              mod
          )
          mod = ethosu_passes.HoistAllocates()(mod)
          mod = tvm.tir.transform.RemoveNoOp()(mod)
          mod, const_dict = ethosu_passes.MergeConstants(const_dict)(
              mod
          )
          mod = ethosu_passes.CopyComputeReordering(
              vapi.get_max_copy_movements()
          )(mod)
  
          disable_storage_rewrite = curr_cfg.get(
              "tir.disable_storage_rewrite", False
          )
          if not disable_storage_rewrite:
              mod = tvm.tir.transform.StorageRewrite()(mod)
  
          mod = tvm.tir.transform.RemoveNoOp()(mod)
          mod = ethosu_passes.AnnotateAllocates()(mod)
          (
              mod,
              const_dict,
          ) = ethosu_passes.CreatePrimFuncWithoutConstants(const_dict)(
              mod
          )
      return mod, 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 1 for calling a global function with example usage: lower_ethosu(sch, args, const_dict, name) and returns: mod,  const_dict