def METHOD_NAME(test_case):
    for device in [flow.device("cpu"), flow.device("cuda:0"), None]:
        for np_dtype in [
            np.float64,
            np.float32,
            np.float16,
            np.int64,
            np.int32,
            np.int8,
            np.uint8,
        ]:
            for flow_dtype in [
                flow.float64,
                flow.float16,
                flow.int64,
                flow.int32,
                flow.int8,
                flow.uint8,
            ]:
                # tuple
                np_arr = (1.0, 2.0, 3.0)
                try:
                    tensor = flow.as_tensor(np_arr, dtype=flow_dtype)
                    test_case.assertTrue(np.array_equal(np_arr, tensor.numpy()))
                except Exception as e:
                    # Ignore cast or kernel mismatch error in test example
                    pass
                # tuple
                np_arr = [1.0, 2.0, 3.0]
                try:
                    tensor = flow.as_tensor(np_arr, dtype=flow_dtype)
                    test_case.assertTrue(np.array_equal(np_arr, tensor.numpy()))
                except Exception as e:
                    # Ignore cast or kernel mismatch error in test example
                    pass
                # scalar
                np_arr = 4.0
                try:
                    tensor = flow.as_tensor(np_arr, dtype=flow_dtype)
                    test_case.assertTrue(np.array_equal(np_arr, tensor.numpy()))
                except Exception as e:
                    # Ignore cast or kernel mismatch error in test example
                    pass