code: def _consolidate_comparisons(
      X: Tensor, Y: Tensor
  ) -> Tuple[Tensor, Tensor]:
      """Drop duplicated Xs and update the indices in Ys accordingly"""
      if Y.shape[-1] != 2:
          raise ValueError(
              "The last dimension of Y must contain 2 elements "
              "representing the pairwise comparison."
          )
  
      if len(Y.shape) != 2:
          raise ValueError("Y must have 2 dimensions.")
  
      X, Y, _ = consolidate_duplicates(X, Y)
      return X, Y
  
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 2 for calling a global function with example usage: _consolidate_comparisons(X, Y) and returns: X,  Y