code: def _create_data(target, dshape, dtype, layout):
      data = relay.var("data", shape=dshape, dtype=dtype)
      w0 = relay.var("w0_weight")
      conv0 = relay.nn.conv2d(
          data, w0, channels=16, kernel_size=(3, 3), padding=(1, 1)
      )
      w1 = relay.var("w1_weight")
      conv1 = relay.nn.conv2d(
          conv0, w1, channels=32, kernel_size=(1, 1)
      )
      w2 = relay.var("w2_weight")
      conv2 = relay.nn.conv2d(
          conv1, w2, channels=32, kernel_size=(3, 3), padding=(1, 1)
      )
      out = relay.add(conv1, conv2)
      net = relay.Function(relay.analysis.free_vars(out), out)
      mod, params = relay.testing.create_workload(net)
      tasks = autotvm.task.extract_from_program(
          mod["main"],
          target=target,
          params=params,
          ops=(relay.op.get("nn.conv2d"),),
      )
      new_args = [
          _create_args(
              (1, 3, 8, 8),
              (16, 3, 3, 3),
              (1, 1),
              (1, 1, 1, 1),
              (1, 1),
              layout,
              layout,
              dtype,
              dtype,
          ),
          _create_args(
              (1, 16, 8, 8),
              (32, 16, 1, 1),
              (1, 1),
              (0, 0, 0, 0),
              (1, 1),
              layout,
              layout,
              dtype,
              dtype,
          ),
          _create_args(
              (1, 32, 8, 8),
              (32, 32, 3, 3),
              (1, 1),
              (1, 1, 1, 1),
              (1, 1),
              layout,
              layout,
              dtype,
              dtype,
          ),
      ]
  
      costs = [0.04, 0.012, 0.03]
      config_list = []
      cfg_dict = {
          "index": -1,
          "code_hash": None,
          "entity": [
              ["tile_ic", "sp", [3, 1]],
              ["tile_oc", "sp", [4, 4]],
              ["tile_ow", "sp", [4, 2]],
              ["unroll_kw", "ot", True],
          ],
      }
      config_list.append(ConfigEntity.from_json_dict(cfg_dict))
      cfg_dict = {
          "index": -1,
          "code_hash": None,
          "entity": [
              ["tile_ic", "sp", [2, 8]],
              ["tile_oc", "sp", [1, 32]],
              ["tile_oh", "ot", 1],
              ["tile_ow", "sp", [4, 2]],
          ],
      }
      config_list.append(ConfigEntity.from_json_dict(cfg_dict))
      cfg_dict = {
          "index": -1,
          "code_hash": None,
          "entity": [
              ["tile_ic", "sp", [8, 4]],
              ["tile_oc", "sp", [4, 8]],
              ["tile_ow", "sp", [2, 4]],
              ["unroll_kw", "ot", False],
          ],
      }
      config_list.append(ConfigEntity.from_json_dict(cfg_dict))
  
      records = []
      for args, cost, config, task in zip(
          new_args, costs, config_list, tasks
      ):
          task.args = args
          ms_input = MeasureInput(
              target=target, task=task, config=config
          )
          ms_output = MeasureResult(
              costs=(cost,), error_no=0, all_cost=-1, timestamp=-1
          )
          records.append((ms_input, ms_output))
  
      ltf_records = []
      ltf_arg = [
          te.placeholder((1, 64, 16, 16, 8), dtype=dtype),
          "NCHW8c",
          "NCHW512c",
      ]
      ltf_task = autotvm.task.create(
          "layout_transform", ltf_arg, target
      )
      ms_input = MeasureInput(target=target, task=ltf_task, config=None)
      ms_output = MeasureResult(
          costs=(1.91224744e-05,), error_no=0, all_cost=-1, timestamp=-1
      )
      ltf_records.append((ms_input, ms_output))
  
      ltf_keys = []
      ltf_arg = [
          te.placeholder((1, 4, 8, 8, 4), dtype=dtype),
          "NCHW4c",
          "NCHW8c",
      ]
      ltf_wkl = autotvm.task.args_to_workload(
          ltf_arg, "layout_transform"
      )
      ltf_keys.append(ltf_wkl)
      ltf_arg = [
          te.placeholder((1, 1, 8, 8, 32), dtype=dtype),
          "NCHW32c",
          "NCHW4c",
      ]
      ltf_wkl = autotvm.task.args_to_workload(
          ltf_arg, "layout_transform"
      )
      ltf_keys.append(ltf_wkl)
      ltf_arg = [
          te.placeholder((1, 4, 8, 8, 8), dtype=dtype),
          "NCHW8c",
          "NCHW32c",
      ]
      ltf_wkl = autotvm.task.args_to_workload(
          ltf_arg, "layout_transform"
      )
      ltf_keys.append(ltf_wkl)
  
      return net, records, ltf_records, ltf_keys, tasks
  
file_path: tvm/tests/python/autotvm/test_autotvm_graph_tuner_core.py
imports: import os
  import copy
  import numpy
  import tvm
  from tvm import te
  import tvm.relay.testing
  from tvm import autotvm
  from tvm import relay
  from tvm.autotvm.task import ConfigEntity
  from tvm.autotvm.measure import MeasureResult, MeasureInput
  from tvm.autotvm.graph_tuner import DPTuner, PBQPTuner
label_desc: Use image node_id 2 for calling a global function with example usage: _create_data(target, dshape, dtype, layout) and returns: net,  records,  ltf_records,  ltf_keys,  tasks