code: def _get_hv_value_function(
      model: Model,
      ref_point: Tensor,
      objective: Optional[MCMultiOutputObjective] = None,
      sampler: Optional[MCSampler] = None,
      project: Optional[Callable[[Tensor], Tensor]] = None,
      valfunc_cls: Optional[Type[AcquisitionFunction]] = None,
      valfunc_argfac: Optional[
          Callable[[Model], Dict[str, Any]]
      ] = None,
      use_posterior_mean: bool = False,
  ) -> AcquisitionFunction:
      r"""Construct value function (i.e. inner acquisition function).
      This is a method for computing hypervolume.
      """
      if use_posterior_mean:
          model = PosteriorMeanModel(model=model)
          sampler = StochasticSampler(
              sample_shape=torch.Size([1])
          )  # dummy sampler
      base_value_function = qExpectedHypervolumeImprovement(
          model=model,
          ref_point=ref_point,
          partitioning=FastNondominatedPartitioning(
              ref_point=ref_point,
              Y=torch.empty(
                  (0, ref_point.shape[0]),
                  dtype=ref_point.dtype,
                  device=ref_point.device,
              ),
          ),  # create empty partitioning
          sampler=sampler,
          objective=objective,
      )
      # ProjectedAcquisitionFunction requires this
      base_value_function.posterior_transform = None
  
      if project is None:
          return base_value_function
      else:
          return ProjectedAcquisitionFunction(
              base_value_function=base_value_function,
              project=project,
          )
  
imports: from copy import deepcopy
  from typing import Any, Callable, Dict, List, Optional, Tuple, Type
  import torch
  from botorch import settings
  from botorch.acquisition.acquisition import AcquisitionFunction, OneShotAcquisitionFunction
  from botorch.acquisition.cost_aware import CostAwareUtility
  from botorch.acquisition.decoupled import DecoupledAcquisitionFunction
  from botorch.acquisition.knowledge_gradient import ProjectedAcquisitionFunction
  from botorch.acquisition.multi_objective.monte_carlo import MultiObjectiveMCAcquisitionFunction, qExpectedHypervolumeImprovement
  from botorch.acquisition.multi_objective.objective import MCMultiOutputObjective
  from botorch.exceptions.errors import UnsupportedError
  from botorch.models.deterministic import PosteriorMeanModel
  from botorch.models.model import Model
  from botorch.sampling.base import MCSampler
  from botorch.sampling.list_sampler import ListSampler
  from botorch.sampling.normal import SobolQMCNormalSampler
  from botorch.sampling.stochastic_samplers import StochasticSampler
  from botorch.utils.multi_objective.box_decompositions.non_dominated import FastNondominatedPartitioning
  from botorch.utils.transforms import match_batch_shape, t_batch_mode_transform
  from torch import Tensor
label_desc: Use image node_id 1 for calling a global function with example usage: _get_hv_value_function(model, ref_point, objective, sampler, project, valfunc_cls, valfunc_argfac, use_posterior_mean) and returns: base_value_function, ProjectedAcquisitionFunction