def METHOD_NAME(x_batch, y_batch, M, N, K):
    dtype = "int8"
    out_dtype = "int32"
    assert x_batch == y_batch or x_batch == 1 or y_batch == 1
    x = te.placeholder((x_batch, M, K), name="x", dtype=dtype)
    y = te.placeholder((y_batch, N, K), name="y", dtype=dtype)
    # use memoize to pickle the test data for next time use
    @memoize("topi.tests.test_topi_batch_matmul")
    def get_ref_data():
        a_np = np.random.randint(low=-128, high=127, size=(x_batch, M, K)).astype(dtype)
        b_np = np.random.randint(low=-128, high=127, size=(y_batch, N, K)).astype(dtype)
        c_np = tvm.topi.testing.batch_matmul(a_np, b_np, out_dtype=out_dtype)
        return (a_np, b_np, c_np)
    # get the test data
    a_np, b_np, c_np = get_ref_data()
    def check_device(device):
        dev = tvm.device(device, 0)
        if device == "cuda" and not tvm.contrib.nvcc.have_int8(dev.compute_version):
            print("Skip because int8 intrinsics are not available")
            return
        print("Running on target: %s" % device)
        with tvm.target.Target(device):
            out = topi.cuda.batch_matmul_int8(x, y, None, out_dtype)
            s = topi.cuda.schedule_batch_matmul_int8([out])
        a = tvm.nd.array(a_np, dev)
        b = tvm.nd.array(b_np, dev)
        c = tvm.nd.array(np.zeros(get_const_tuple(out.shape), dtype=out_dtype), dev)
        f = tvm.build(s, [x, y, out], device, name="batch_matmul_int8")
        f(a, b, c)
        tvm.testing.assert_allclose(c.numpy(), c_np, rtol=1e-5)
    for device in ["cuda"]:
        check_device(device)