def get_batch_size(dataset):
    """Get the batch size of the dataset."""
    if is_batched(dataset):
        return dataset._batch_size
    else:
        return None
Get the batch size of the dataset.
keras/src/utils/dataset_utils.py