def list_to_tuple(maybe_list):
    """Datasets will stack any list of tensors, so we convert them to tuples."""
    if isinstance(maybe_list, list):
        return tuple(maybe_list)
    return maybe_list
Datasets will stack any list of tensors, so we convert them to tuples.
keras/src/trainers/data_adapters/data_adapter_utils.py