code: def _binary_pref_to_comp_pair(Y: Tensor) -> Tensor:
      """Convert Y from binary indicator pair to index pair comparisons
  
      Convert Y from binary indicator pair such as [[0, 1], [1, 0], ...]
      to index comparisons like [[1, 0], [2, 3], ...]
      """
      Y_shape = Y.shape[:-2] + (-1, 2)
      Y = Y.reshape(Y_shape)
  
      _validate_Y_values(Y)
  
      idx_shift = (
          (torch.arange(0, Y.shape[-2]) * 2).unsqueeze(-1).expand_as(Y)
      )
      comparison_pairs = idx_shift + (1 - Y)
      return comparison_pairs
  
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 1 for calling a global function with example usage: _binary_pref_to_comp_pair(Y) and returns: comparison_pairs