code: def partition_for_ethosn(mod, params=None, **opts):
      """Partition the graph greedily offloading supported
      operators to Arm Ethos-N NPU.
  
      Parameters
      ----------
      mod : Module
          The module to run passes on.
      params : Optional[Dict[str, NDArray]]
          Constant input parameters.
  
      Returns
      -------
      ret : annotated and partitioned module.
      """
      api_version = ethosn_api_version()
      supported_api_versions = ["3.2.0"]
      if all(
          api_version != LooseVersion(exp_ver)
          for exp_ver in supported_api_versions
      ):
          raise ValueError(
              f"Driver stack version {api_version} is unsupported. "
              f"Please use version in {supported_api_versions}."
          )
  
      if params:
          mod["main"] = bind_params_by_name(mod["main"], params)
  
      passes = [
          transform.InferType(),
          transform.FoldConstant(fold_qnn=True),
          transform.MergeComposite(pattern_table()),
          transform.AnnotateTarget("ethos-n"),
          transform.MergeCompilerRegions(),
          transform.PartitionGraph(),
          ConvertEquivalents(),
      ]
      if is_inline_non_compute_intensive_partitions_enabled():
          passes.append(InlineNonComputeIntensivePartitions())
  
      return tvm.transform.Sequential(passes)(mod)
  
imports: from enum import Enum
  from distutils.version import LooseVersion
  import tvm.ir
  from tvm.relay import transform
  from tvm.relay.build_module import bind_params_by_name
  from ...dataflow_pattern import is_constant, is_op, wildcard
  from .None import _ethosn
  from .register import register_pattern_table
label_desc: Use image node_id 6 for calling a global function with example usage: partition_for_ethosn(mod, params) and returns: tvm