def METHOD_NAME(target, dev, cast_ref_data, from_dtype, to_dtype):
    m = te.var("m")
    l = te.var("l")
    A = te.placeholder((m, l), dtype=from_dtype, name="A")
    B = topi.cast(A, to_dtype)
    a_np, b_np = cast_ref_data
    with tvm.target.Target(target):
        s = tvm.topi.testing.get_injective_schedule(target)(B)
    foo = tvm.build(s, [A, B], target)
    a = tvm.nd.array(a_np, dev)
    b = tvm.nd.empty(b_np.shape, dtype=to_dtype, device=dev)
    foo(a, b)
    tvm.testing.assert_allclose(b.numpy(), b_np)