when argument batch_size is bool, tf.data.experimental.dense_to_ragged_batch works
Hi @cheyennee 
Thank you for reporting the issue.
I was able to replicate the issue in Colab using Tensorflow version 2.12 and tf-nightly(2.14.0.dev20230510). Please find the gists here - [TF v2.12](https://colab.sandbox.google.com/gist/synandi/b88c93c8a40e2db065ba8d181e4e23e0/60531_2-12.ipynb) & [tf-nightly](https://colab.sandbox.google.com/gist/synandi/0da24695a925fc59e0683daa127ff81d/60531_nightly.ipynb).  Hi @cheyennee, Apologies for the delay.

The `tf.data.experimental.dense_to_ragged_batch` API works with `tf.dataset.Data`. As you are not applying the `tf.data.experimental.dense_to_ragged_batch` to a dataset, you are not seeing any error when passing invalid inputs. Kindly check the following code with an error when using batch_size=False.
```
import tensorflow as tf
import numpy as np

dataset = tf.data.Dataset.from_tensor_slices(np.arange(6))
dataset = dataset.map(lambda x: tf.range(x))
dataset.element_spec.shape

batch_size = False

dataset = dataset.apply(
    tf.data.experimental.dense_to_ragged_batch(batch_size=batch_size))
for batch in dataset:
  print(batch)
```
**Error:**
```
InvalidArgumentError: {{function_node __wrapped__BatchDatasetV2_device_/job:localhost/replica:0/task:0/device:CPU:0}} Batch size must be greater than zero. [Op:BatchDatasetV2]
```
 Kindly refer to this [gist](https://colab.sandbox.google.com/gist/synandi/0513dbd7513ba30de6606f1a2ed8cda3/60531_2-12.ipynb#scrollTo=HqiLMxxciArL). Thank you! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. @synandi Why when I am not applying the tf.data.experimental.dense_to_ragged_batch to a dataset, I cannot see any error when passing invalid inputs? I think maybe you should consider other data format rather than dataset, is this possible? Or does it need a lot of efforts to do validate on other data format? @cheyennee,
Looks like there is already an issue that was still open for the similar feature/issue. Could you please take a look at the issue and try to follow the similar thread for the update.
https://github.com/tensorflow/tensorflow/issues/42349
 Thank you! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60531">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60531">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

Yes

### Source

source

### Tensorflow Version

tf 2.12.0

### Custom Code

Yes

### OS Platform and Distribution

win11

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

According to [doc](https://tensorflow.google.cn/api_docs/python/tf/data/experimental/dense_to_ragged_batch), the argument `batch_size` should be int64. But in following snippet code, when it's bool type, the API `tf.data.experimental.dense_to_ragged_batch` also works. If this is due to the type cast in API, then the documentation should make it clear that the argument `batch_size` can be bool type as well. If this is an unexpected type cast, then this issue should be fixed.

### Standalone code to reproduce the issue

```shell
results = dict()
import tensorflow as tf
with tf.device('/CPU'):
  batch_size = False
  results["res_cpu"] = tf.data.experimental.dense_to_ragged_batch(batch_size=batch_size,)
with tf.device('/GPU:0'):
  results["res_gpu"] = tf.data.experimental.dense_to_ragged_batch(batch_size=batch_size,)
print(results)
#results={'res_cpu': <function dense_to_ragged_batch.<locals>._apply_fn at 0x7f0f5974a3b0>, 'res_gpu': <function dense_to_ragged_batch.<locals>._apply_fn at 0x7f0f5974a710>}

```


### Relevant log output

_No response_</details>