code: def _extract_observed_pareto_2d(
      Y: np.ndarray,
      reference_point: Optional[Tuple[float, float]],
      minimize: Union[bool, Tuple[bool, bool]] = True,
  ) -> np.ndarray:
      if Y.shape[1] != 2:
          raise NotImplementedError(
              "Currently only the 2-dim case is handled."
          )
      # If `minimize` is a bool, apply to both dimensions
      if isinstance(minimize, bool):
          minimize = (minimize, minimize)
      Y_copy = deepcopy(torch.from_numpy(Y).to())
      if reference_point:
          ref_point = torch.tensor(reference_point, dtype=Y_copy.dtype)
          for i in range(2):
              # Filter based on reference point
              Y_copy = (
                  Y_copy[Y_copy[:, i] < ref_point[i]]
                  if minimize[i]
                  else Y_copy[Y_copy[:, i] > ref_point[i]]
              )
      for i in range(2):
          # Flip sign in each dimension based on minimize
          Y_copy[:, i] *= (-1) ** minimize[i]
      Y_pareto = Y_copy[is_non_dominated(Y_copy)]
      Y_pareto = Y_pareto[
          torch.argsort(input=Y_pareto[:, 0], descending=True)
      ]
      for i in range(2):
          # Flip sign back
          Y_pareto[:, i] *= (-1) ** minimize[i]
  
      assert (
          Y_pareto.shape[1] == 2
      )  # Y_pareto should have two outcomes.
      return Y_pareto.detach().cpu().numpy()
  
imports: import copy
  from copy import deepcopy
  from itertools import combinations
  from logging import Logger
  from typing import cast, Dict, List, NamedTuple, Optional, Tuple, Union
  import numpy
  import torch
  from ax.core.batch_trial import BatchTrial
  from ax.core.data import Data
  from ax.core.experiment import Experiment
  from ax.core.metric import Metric
  from ax.core.objective import ScalarizedObjective
  from ax.core.observation import ObservationFeatures
  from ax.core.optimization_config import MultiObjectiveOptimizationConfig, OptimizationConfig
  from ax.core.outcome_constraint import ComparisonOp, ObjectiveThreshold, OutcomeConstraint
  from ax.core.search_space import RobustSearchSpace, SearchSpace
  from ax.core.types import TParameterization
  from ax.exceptions.core import AxError, UnsupportedError, UserInputError
  from ax.modelbridge.modelbridge_utils import _get_modelbridge_training_data, get_pareto_frontier_and_configs, observed_pareto_frontier
  from ax.modelbridge.registry import Models
  from ax.modelbridge.torch import TorchModelBridge
  from ax.modelbridge.transforms.search_space_to_float import SearchSpaceToFloat
  from ax.models.torch.posterior_mean import get_PosteriorMean
  from ax.models.torch_base import TorchModel
  from ax.utils.common.logger import get_logger
  from ax.utils.stats.statstools import relativize
  from botorch.utils.multi_objective import is_non_dominated
  from botorch.utils.multi_objective.hypervolume import infer_reference_point
label_desc: Use image node_id 1 for calling a global function with example usage: _extract_observed_pareto_2d(Y, reference_point, minimize) and returns: Y_pareto