code: def _validate_Y_values(Y: Tensor) -> None:
      """Check if Ys have valid values"""
      # Y must have even number of elements
      if Y.shape[-1] != 2:
          raise ValueError(
              f"Trailing dimension of `Y` should be size 2 but is {Y.shape[-1]}"
          )
  
      # all adjacent pairs must have exactly a 0 and a 1
      if not (
          Y.min(dim=-1).values.eq(0).all()
          and Y.max(dim=-1).values.eq(1).all()
      ):
          raise ValueError("`Y` values must be `{0, 1}.`")
  
file_path: Ax/ax/modelbridge/pairwise.py
imports: from __future__ import annotations
  from typing import List, Optional, Tuple
  import numpy
  import torch
  from ax.core.observation import ObservationData, ObservationFeatures
  from ax.core.search_space import SearchSpaceDigest
  from ax.core.types import TCandidateMetadata
  from ax.modelbridge.torch import TorchModelBridge
  from botorch.models.utils.assorted import consolidate_duplicates
  from botorch.utils.containers import SliceContainer
  from botorch.utils.datasets import RankingDataset, SupervisedDataset
  from torch import Tensor
label_desc: Use image node_id 3 for calling a global function with example usage: _validate_Y_values(Y) without return types