docstr: Tune the TVMScript code.
  
  Parameters
  ----------
  config: Optional[TuneConfig]
      The tuning configuration.
  
  target : Optional[str, Target]
      The target to tune for.
docstr_tok: ["Tune","the","TVMScript","code",".","Parameters","--","--","--","--","--","config",":","Optional","[","TuneConfig","]","The","tuning","configuration",".","target",":","Optional","[","str",",","Target","]","The","target","to","tune","for","."]
code: def tune(
      self,
      target: Union[str, Target] = "cpu",
      max_trials_global: int = 32,
      *,
      num_trials_per_iter: int = 32,
      builder: ms.Builder.BuilderType = "local",
      runner: ms.Runner.RunnerType = "local",
      database: ms.Database.DatabaseType = "json",
      cost_model: ms.CostModel.CostModelType = "xgb",
      measure_callbacks: ms.MeasureCallback.CallbackListType = "default",
      task_scheduler: ms.TaskScheduler.TaskSchedulerType = "round-robin",
      space: ms.SpaceGenerator.SpaceGeneratorType = "post-order-apply",
      strategy: ms.SearchStrategy.SearchStrategyType = "replay-trace",
      num_tuning_cores: Union[
          Literal["physical", "logical"], int
      ] = "physical",
      seed: Optional[int] = None,
  ) -> None:
      """
      Tune the TVMScript code.
  
      Parameters
      ----------
      config: Optional[TuneConfig]
          The tuning configuration.
  
      target : Optional[str, Target]
          The target to tune for.
      """
      if target == "cpu":
          target = (
              f"llvm --num-cores {ms.utils.cpu_count(logical=False)}"
          )
  
      with tempfile.TemporaryDirectory() as work_dir:
          database = ms.tir_integration.tune_tir(
              mod=self.ir_module,
              target=target,
              work_dir=work_dir,
              max_trials_global=max_trials_global,
              num_trials_per_iter=num_trials_per_iter,
              builder=builder,
              runner=runner,
              database=database,
              cost_model=cost_model,
              measure_callbacks=measure_callbacks,
              task_scheduler=task_scheduler,
              space=space,
              strategy=strategy,
              num_tuning_cores=num_tuning_cores,
              seed=seed,
          )
          sch = ms.tir_integration.compile_tir(
              database, self.ir_module, target
          )
          self.ir_module = sch.mod
          self.build(target)
  
file_path: tvm/python/tvm/contrib/torch/as_torch.py
imports: import tempfile
  from typing import Callable, List, Optional, Union
  from typing_extensions import Literal
  import torch
  import torch.utils.dlpack
  import tvm
  from tvm import meta_schedule
  from tvm.target.target import Target
  from tvm.tir import PrimFunc
label_desc: Use image node_id 2 for calling the OperatorModuleWrapper obj's underlying member method code with example usage: obj.tune(target, max_trials_global) without return types