code: def extract_from_relay(
      mod: IRModule,
      target: Target,
      params: Optional[Dict[str, NDArray]],
      name: str,
      input_shape: List[int],
      *,
      cache_dir: Optional[str] = None,
  ) -> List[ms.ExtractedTask]:
      """Extract the tasks from a network.
  
      Parameters
      ----------
      mod : IRModule
          The IRModule representing the network.
      target : Target
          The target that the network will be deployed to.
      params : Optional[Dict[str, NDArray]]
          The parameters of the networks.
      name : str
          The name of the network.
      input_shape : List[int]
          The shape of the input tensor.
      cache_dir : Optional[str]
          The directory to cache the generated network.
          If not specified, the cache will be disabled.
  
      Returns
      -------
      extracted_tasks : List[ExtractedTask]
          The extracted tasks.
      """
      filename = f'tasks-{target.kind.name}-{name}-{",".join(str(i) for i in input_shape)}.json'
      extracted_tasks = _load_cache(cache_dir, filename)
      if extracted_tasks is None:
          extracted_tasks = ms.relay_integration.extract_tasks(
              mod=mod,
              target=target,
              params=params,
          )
          extracted_tasks = list(extracted_tasks)
          _save_cache(cache_dir, filename, extracted_tasks)
      return extracted_tasks
  
file_path: tvm/python/tvm/meta_schedule/testing/relay_workload.py
imports: import logging
  import multiprocessing
  import os
  import pickle
  from typing import Any, Dict, List, Optional, Tuple
  import tvm
  import tvm.relay.testing
  from tvm import meta_schedule
  from tvm import relay
  from tvm.ir import IRModule
  from tvm.runtime import NDArray, load_param_dict, save_param_dict
  from tvm.target import Target
label_desc: Use image node_id 5 for calling a global function with example usage: extract_from_relay(mod, target, params, name, input_shape) and returns: extracted_tasks