def METHOD_NAME(
    target,
    dev,
    batch_size,
    in_dim,
    out_dim,
    use_bias,
    dense_ref_data,
    in_dtype,
    out_dtype,
    implementations=None,
):
    target = tvm.target.Target(target)
    if target.kind.name == "cuda":
        if in_dtype == "int8" and not tvm.contrib.nvcc.have_int8(dev.compute_version):
            pytest.xfail("CUDA int8 intrinsics not available")
        if in_dtype == "float16" and not tvm.contrib.nvcc.have_fp16(dev.compute_version):
            pytest.xfail("CUDA float16 intrinsics not available")
    if target.kind.name == "vulkan":
        if in_dtype == "int8" and (
            not target.attrs.get("supports_int8", False)
            or not target.attrs.get("supports_8bit_buffer", False)
        ):
            pytest.xfail("Vulkan int8 driver support not available")
        if in_dtype == "float16" and (
            not target.attrs.get("supports_float16", False)
            or not target.attrs.get("supports_16bit_buffer", False)
        ):
            pytest.xfail("Vulkan float16 driver support not available")
    if (
        target.kind.name not in ["llvm", "c"]
        and len(set(target.keys) & set(_dense_implementations)) == 0
    ):
        pytest.xfail("No implementation for tvm.topi.testing.dispatch to find")
    if "int" in in_dtype:
        tol = {"atol": 0, "rtol": 0}
    elif in_dtype == "float32":
        tol = {"rtol": 1e-5, "atol": 1e-5}
    elif in_dtype == "float16":
        tol = {"rtol": 5e-2, "atol": 1e-5}
    A = te.placeholder((batch_size, in_dim), name="A", dtype=in_dtype)
    B = te.placeholder((out_dim, in_dim), name="B", dtype=in_dtype)
    C = te.placeholder((out_dim,), name="C", dtype=out_dtype)
    a_np, b_np, c_np, d_np = dense_ref_data
    if implementations is None:
        implementations = tvm.topi.testing.dispatch(target, _dense_implementations)
    for fcompute, fschedule in implementations:
        if fcompute == topi.x86.dense_dynamic and (batch_size != 1 or in_dtype != "float32"):
            continue
        with tvm.target.Target(target):
            D = fcompute(A, B, C if use_bias else None, out_dtype)
            D = topi.nn.relu(D)
            s = fschedule([D])
        a = tvm.nd.array(a_np, dev)
        b = tvm.nd.array(b_np, dev)
        c = tvm.nd.array(c_np, dev)
        d = tvm.nd.array(np.zeros(get_const_tuple(D.shape), dtype=out_dtype), dev)
        f = tvm.build(s, [A, B, C, D], target, name="dense")
        f(a, b, c, d)
        tvm.testing.assert_allclose(d.numpy(), d_np, **tol)