code: def _get_NEHVI(
      acqf_name: str,
      model: Model,
      objective_weights: Tensor,
      objective_thresholds: Tensor,
      outcome_constraints: Optional[Tuple[Tensor, Tensor]] = None,
      X_observed: Optional[Tensor] = None,
      X_pending: Optional[Tensor] = None,
      *,
      prune_baseline: bool = True,
      mc_samples: int = DEFAULT_EHVI_MC_SAMPLES,
      alpha: Optional[float] = None,
      marginalize_dim: Optional[int] = None,
      cache_root: bool = True,
      seed: Optional[int] = None,
  ) -> Union[
      qNoisyExpectedHypervolumeImprovement,
      qLogNoisyExpectedHypervolumeImprovement,
  ]:
      if X_observed is None:
          raise ValueError(NO_FEASIBLE_POINTS_MESSAGE)
      # construct Objective module
      (
          objective,
          objective_thresholds,
      ) = get_weighted_mc_objective_and_objective_thresholds(
          objective_weights=objective_weights,
          objective_thresholds=objective_thresholds,
      )
      # For EHVI acquisition functions we pass the constraint transform directly.
      if outcome_constraints is None:
          cons_tfs = None
      else:
          cons_tfs = get_outcome_constraint_transforms(
              outcome_constraints
          )
      num_objectives = objective_thresholds.shape[0]
      if alpha is None:
          alpha = get_default_partitioning_alpha(
              num_objectives=num_objectives
          )
      # NOTE: Not using checked_cast here because for Python 3.9, isinstance fails with
      # `TypeError: Subscripted generics cannot be used with class and instance checks`.
      return cast(
          Union[
              qNoisyExpectedHypervolumeImprovement,
              qLogNoisyExpectedHypervolumeImprovement,
          ],
          get_acquisition_function(
              acquisition_function_name=acqf_name,
              model=model,
              objective=objective,
              X_observed=X_observed,
              X_pending=X_pending,
              constraints=cons_tfs,
              prune_baseline=prune_baseline,
              mc_samples=mc_samples,
              alpha=alpha,
              seed=seed
              if seed is not None
              else cast(int, torch.randint(1, 10000, (1,)).item()),
              ref_point=objective_thresholds.tolist(),
              marginalize_dim=marginalize_dim,
              cache_root=cache_root,
          ),
      )
  
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 5 for calling a global function with example usage: _get_NEHVI(acqf_name, model, objective_weights, objective_thresholds, outcome_constraints, X_observed, X_pending) and returns: cast