keras/src/trainers/data_adapters/array_slicing.py/can_slice_array
def can_slice_array(x):
    return (
        x is None
        or isinstance(x, ARRAY_TYPES)
        or data_adapter_utils.is_tensorflow_tensor(x)
        or data_adapter_utils.is_jax_array(x)
        or data_adapter_utils.is_torch_tensor(x)
        or data_adapter_utils.is_scipy_sparse(x)
        or hasattr(x, "__array__")
    )