code: def pareto_frontier_evaluator(
      model: Optional[TorchModel],
      objective_weights: Tensor,
      objective_thresholds: Optional[Tensor] = None,
      X: Optional[Tensor] = None,
      Y: Optional[Tensor] = None,
      Yvar: Optional[Tensor] = None,
      outcome_constraints: Optional[Tuple[Tensor, Tensor]] = None,
  ) -> Tuple[Tensor, Tensor, Tensor]:
      """Return outcomes predicted to lie on a pareto frontier.
  
      Given a model and points to evaluate, use the model to predict which points
      lie on the Pareto frontier.
  
      Args:
          model: Model used to predict outcomes.
          objective_weights: A `m` tensor of values indicating the weight to put
              on different outcomes. For pareto frontiers only the sign matters.
          objective_thresholds:  A tensor containing thresholds forming a reference point
              from which to calculate pareto frontier hypervolume. Points that do not
              dominate the objective_thresholds contribute nothing to hypervolume.
          X: A `n x d` tensor of features to evaluate.
          Y: A `n x m` tensor of outcomes to use instead of predictions.
          Yvar: A `n x m x m` tensor of input covariances (NaN if unobserved).
          outcome_constraints: A tuple of (A, b). For k outcome constraints
              and m outputs at f(x), A is (k x m) and b is (k x 1) such that
              A f(x) <= b.
  
      Returns:
          3-element tuple containing
  
          - A `j x m` tensor of outcome on the pareto frontier. j is the number
              of frontier points.
          - A `j x m x m` tensor of predictive covariances.
              cov[j, m1, m2] is Cov[m1@j, m2@j].
          - A `j` tensor of the index of each frontier point in the input Y.
      """
      # TODO: better input validation, making more explicit whether we are using
      # model predictions or not
      if X is not None:
          Y, Yvar = not_none(model).predict(X)
          # model.predict returns cpu tensors
          Y = Y.to(X.device)
          Yvar = Yvar.to(X.device)
      elif Y is None or Yvar is None:
          raise ValueError(
              "Requires `X` to predict or both `Y` and `Yvar` to select a subset of "
              "points on the pareto frontier."
          )
  
      # Apply objective_weights to outcomes and objective_thresholds.
      # If objective_thresholds is not None use a dummy tensor of zeros.
      (
          obj,
          weighted_objective_thresholds,
      ) = get_weighted_mc_objective_and_objective_thresholds(
          objective_weights=objective_weights,
          objective_thresholds=(
              objective_thresholds
              if objective_thresholds is not None
              else torch.zeros(
                  objective_weights.shape,
                  dtype=objective_weights.dtype,
                  device=objective_weights.device,
              )
          ),
      )
      Y_obj = obj(Y)
      indx_frontier = torch.arange(
          Y.shape[0], dtype=torch.long, device=Y.device
      )
  
      # Filter Y, Yvar, Y_obj to items that dominate all objective thresholds
      if objective_thresholds is not None:
          objective_thresholds_mask = torch.all(
              Y_obj >= weighted_objective_thresholds, dim=1
          )
          Y = Y[objective_thresholds_mask]
          Yvar = Yvar[objective_thresholds_mask]
          Y_obj = Y_obj[objective_thresholds_mask]
          indx_frontier = indx_frontier[objective_thresholds_mask]
  
      # Get feasible points that do not violate outcome_constraints
      if outcome_constraints is not None:
          cons_tfs = get_outcome_constraint_transforms(
              outcome_constraints
          )
          # pyre-ignore [16]
          feas = torch.stack([c(Y) <= 0 for c in cons_tfs], dim=-1).all(
              dim=-1
          )
          Y = Y[feas]
          Yvar = Yvar[feas]
          Y_obj = Y_obj[feas]
          indx_frontier = indx_frontier[feas]
  
      if Y.shape[0] == 0:
          # if there are no feasible points that are better than the reference point
          # return empty tensors
          return Y.cpu(), Yvar.cpu(), indx_frontier.cpu()
  
      # calculate pareto front with only objective outcomes:
      frontier_mask = is_non_dominated(Y_obj)
  
      # Apply masks
      Y_frontier = Y[frontier_mask]
      Yvar_frontier = Yvar[frontier_mask]
      indx_frontier = indx_frontier[frontier_mask]
      return Y_frontier.cpu(), Yvar_frontier.cpu(), indx_frontier.cpu()
  
imports: from __future__ import annotations
  from typing import Callable, cast, Dict, List, Optional, Tuple, Union
  import torch
  from ax.exceptions.core import AxError
  from ax.models.torch.botorch_defaults import NO_FEASIBLE_POINTS_MESSAGE
  from ax.models.torch.utils import _get_X_pending_and_observed, get_outcome_constraint_transforms, subset_model
  from ax.models.torch_base import TorchModel
  from ax.utils.common.typeutils import checked_cast, not_none
  from botorch.acquisition import get_acquisition_function
  from botorch.acquisition.acquisition import AcquisitionFunction
  from botorch.acquisition.multi_objective.logei import qLogExpectedHypervolumeImprovement, qLogNoisyExpectedHypervolumeImprovement
  from botorch.acquisition.multi_objective.monte_carlo import qExpectedHypervolumeImprovement, qNoisyExpectedHypervolumeImprovement
  from botorch.acquisition.multi_objective.objective import WeightedMCMultiOutputObjective
  from botorch.acquisition.multi_objective.utils import get_default_partitioning_alpha
  from botorch.models.model import Model
  from botorch.optim.optimize import optimize_acqf_list
  from botorch.posteriors.gpytorch import GPyTorchPosterior
  from botorch.posteriors.posterior import Posterior
  from botorch.posteriors.posterior_list import PosteriorList
  from botorch.utils.multi_objective.hypervolume import infer_reference_point
  from botorch.utils.multi_objective.pareto import is_non_dominated
  from torch import Tensor
label_desc: Use image node_id 10 for calling a global function with example usage: pareto_frontier_evaluator(model, objective_weights, objective_thresholds, X, Y, Yvar, outcome_constraints) and returns: Y_frontier,  Yvar_frontier,  indx_frontier, Y,  Yvar,  indx_frontier