code: def test_select_implementation():
      target = tvm.target.Target("llvm")
  
      def _select_impl(dshape, wshape, use_autotvm=False):
          data = relay.var("data", shape=dshape)
          weight = relay.var("wshape", shape=wshape)
          out = relay.nn.conv2d(data, weight, padding=(1, 1))
          out = run_infer_type(out)
          return relay.backend.te_compiler.select_implementation(
              relay.op.get("nn.conv2d"),
              out.attrs,
              [te.placeholder(dshape), te.placeholder(wshape)],
              out.checked_type,
              target,
              use_autotvm,
          )
  
      with TempOpAttr("nn.conv2d", "FTVMStrategy", _tmp_strategy):
          impl, _ = _select_impl((1, 8, 7, 7), (32, 8, 3, 3))
          assert impl.name == "conv2d_2"
          impl, _ = _select_impl((1, 8, 7, 7), (32, 8, 3, 3), True)
          assert impl.name == "conv2d_2"
          impl, _ = _select_impl((1, 16, 7, 7), (32, 16, 3, 3))
          assert impl.name == "conv2d_3"
          impl, _ = _select_impl((1, 16, 7, 7), (32, 16, 3, 3), True)
          assert impl.name == "conv2d_3"
  
          # add autotvm record
          records = []
          records.append(
              _create_record(
                  "test/conv2d_1",
                  (1, 8, 7, 7),
                  (32, 8, 3, 3),
                  target,
                  0.5,
              )
          )
          records.append(
              _create_record(
                  "test/conv2d_1",
                  (1, 16, 7, 7),
                  (32, 16, 3, 3),
                  target,
                  1.0,
              )
          )
          with target:
              with autotvm.apply_history_best(records):
                  impl, _ = _select_impl(
                      (1, 8, 7, 7), (32, 8, 3, 3), True
                  )
                  assert impl.name == "conv2d_1"
                  impl, _ = _select_impl(
                      (1, 16, 7, 7), (32, 16, 3, 3), True
                  )
                  assert impl.name == "conv2d_1"
  
          records.append(
              _create_record(
                  "test/conv2d_2",
                  (1, 8, 7, 7),
                  (32, 8, 3, 3),
                  target,
                  0.2,
              )
          )
          records.append(
              _create_record(
                  "test/conv2d_1",
                  (1, 16, 7, 7),
                  (32, 16, 3, 3),
                  target,
                  1.2,
              )
          )
          with target:
              with autotvm.apply_history_best(records):
                  impl, _ = _select_impl(
                      (1, 8, 7, 7), (32, 8, 3, 3), True
                  )
                  assert impl.name == "conv2d_2"
                  impl, _ = _select_impl(
                      (1, 16, 7, 7), (32, 16, 3, 3), True
                  )
                  assert impl.name == "conv2d_1"
  
imports: import numpy
  import tvm
  from tvm import te
  import tvm.testing
  from tvm import relay
  from tvm import autotvm
  from tvm import topi
  from tvm.relay.backend import te_compiler
  from tvm.relay.testing import run_infer_type
  from tvm.relay.testing.temp_op_attr import TempOpAttr
label_desc: Use image node_id 10 for calling a global function with example usage: test_select_implementation() and returns: relay