code: def _autoscheduler_test_helper(
      model, tmpdir_name, early_stopping=1, prior_records=None
  ):
      tvmc_model = tvmc.frontends.load_model(model)
      log_file = os.path.join(tmpdir_name, "autoscheduler.json")
  
      hardware_params = auto_scheduler.HardwareParams(
          num_cores=4, target="llvm"
      )
  
      tvmc.tune(
          tvmc_model,
          target="llvm",
          tuning_records=log_file,
          prior_records=prior_records,
          early_stopping=early_stopping,
          enable_autoscheduler=True,
          trials=2,
          hardware_params=hardware_params,
      )
  
      # testing whether the log file was produced
      assert path.exists(
          log_file
      ), "autoscheduler log file should exist"
  
      with auto_scheduler.ApplyHistoryBest(log_file) as best:
          assert isinstance(
              best, auto_scheduler.dispatcher.ApplyHistoryBest
          ), "unable to load the best results of tuning"
  
      return log_file
  
file_path: tvm/tests/python/driver/tvmc/test_autoscheduler.py
imports: import platform
  import pytest
  import os
  from os import path
  from tvm import auto_scheduler
  from tvm.driver import tvmc
label_desc: Use image node_id 2 for calling a global function with example usage: _autoscheduler_test_helper(model, tmpdir_name, early_stopping, prior_records) and returns: log_file