code: def test_dense(target, expected_valid_impl, expected_impl):
      target = tvm.target.Target(target)
  
      data_shape = (30, 40)
      weight_shape = (30, 40)
      dtype = "float32"
  
      out = relay.nn.dense(
          relay.var("data", shape=data_shape, dtype=dtype),
          relay.var("weight", shape=weight_shape, dtype=dtype),
          out_dtype=dtype,
      )
      out = run_infer_type(out)
  
      with target:
          args = [
              out.op,
              out.attrs,
              [
                  te.placeholder(data_shape, dtype),
                  te.placeholder(weight_shape, dtype),
              ],
              out.checked_type,
              target,
          ]
          valid_impl = (
              relay.backend.te_compiler.get_valid_implementations(*args)
          )
          (
              selected_impl,
              _,
          ) = relay.backend.te_compiler.select_implementation(
              *args, use_autotvm=False
          )
  
      assert len(valid_impl) == len(expected_valid_impl)
      for impl in valid_impl:
          assert impl.name in expected_valid_impl
      assert selected_impl.name == expected_impl
  
file_path: tvm/tests/python/relay/strategy/test_select_implementation.py
imports: import pytest
  import numpy
  from unittest.mock import MagicMock
  import tvm
  from tvm import relay
  from tvm import te
  from tvm.relay.testing import run_infer_type, run_opt_pass
  import tvm.testing
  from tvm import topi
label_desc: Use image node_id 7 for calling a global function with example usage: test_dense(target, expected_valid_impl, expected_impl) without return types