code: def sample_optimal_points(
      model: Model,
      bounds: Tensor,
      num_samples: int,
      num_points: int,
      optimizer: Callable[
          [GenericDeterministicModel, Tensor, int, bool, Any],
          Tuple[Tensor, Tensor],
      ] = random_search_optimizer,
      num_rff_features: int = 512,
      maximize: bool = True,
      optimizer_kwargs: Optional[Dict[str, Any]] = None,
  ) -> Tuple[Tensor, Tensor]:
      r"""Compute a collection of optimal inputs and outputs from samples of a Gaussian
      Process (GP).
  
      Steps:
      (1) The samples are generated using random Fourier features (RFFs).
      (2) The samples are optimized sequentially using an optimizer.
  
      TODO: We can generalize the GP sampling step to accommodate for other sampling
          strategies rather than restricting to RFFs e.g. decoupled sampling.
  
      TODO: Currently this defaults to random search optimization, might want to
          explore some other alternatives.
  
      Args:
          model: The model. This does not support models which include fantasy
              observations.
          bounds: A `2 x d`-dim Tensor containing the input bounds.
          num_samples: The number of GP samples.
          num_points: The number of optimal points to be outputted.
          optimizer: A callable that solves the deterministic optimization problem.
          num_rff_features: The number of random Fourier features.
          maximize: If true, we consider a maximization problem.
          optimizer_kwargs: The additional arguments for the optimizer.
  
      Returns:
          A two-element tuple containing
  
          - A `num_samples x num_points x d`-dim Tensor containing the collection of
              optimal inputs.
          - A `num_samples x num_points x M`-dim Tensor containing the collection of
              optimal objectives.
      """
      tkwargs = {"dtype": bounds.dtype, "device": bounds.device}
      M = model.num_outputs
      d = bounds.shape[-1]
      if M == 1:
          if num_points > 1:
              raise UnsupportedError(
                  "For single-objective optimization `num_points` should be 1."
              )
      if optimizer_kwargs is None:
          optimizer_kwargs = {}
      pareto_sets = torch.zeros((num_samples, num_points, d), **tkwargs)
      pareto_fronts = torch.zeros(
          (num_samples, num_points, M), **tkwargs
      )
      for i in range(num_samples):
          sample_i = get_gp_samples(
              model=model,
              num_outputs=M,
              n_samples=1,
              num_rff_features=num_rff_features,
          )
          ps_i, pf_i = optimizer(
              model=sample_i,
              bounds=bounds,
              num_points=num_points,
              maximize=maximize,
              **optimizer_kwargs,
          )
          pareto_sets[i, ...] = ps_i
          pareto_fronts[i, ...] = pf_i
  
      return pareto_sets, pareto_fronts
  
imports: from __future__ import annotations
  import math
  import warnings
  from math import ceil
  from typing import Any, Callable, Dict, List, Optional, Tuple
  import torch
  from botorch.acquisition import monte_carlo
  from botorch.acquisition.multi_objective.objective import IdentityMCMultiOutputObjective, MCMultiOutputObjective
  from botorch.exceptions.errors import UnsupportedError
  from botorch.exceptions.warnings import BotorchWarning
  from botorch.models.deterministic import GenericDeterministicModel
  from botorch.models.fully_bayesian import MCMC_DIM
  from botorch.models.model import Model
  from botorch.sampling.get_sampler import get_sampler
  from botorch.utils.gp_sampling import get_gp_samples
  from botorch.utils.multi_objective.box_decompositions.box_decomposition import BoxDecomposition
  from botorch.utils.multi_objective.box_decompositions.box_decomposition_list import BoxDecompositionList
  from botorch.utils.multi_objective.box_decompositions.dominated import DominatedPartitioning
  from botorch.utils.multi_objective.pareto import is_non_dominated
  from botorch.utils.objective import compute_feasibility_indicator
  from botorch.utils.sampling import draw_sobol_samples
  from botorch.utils.transforms import is_ensemble
  from torch import Tensor
label_desc: Use image node_id 5 for calling a global function with example usage: sample_optimal_points(model, bounds, num_samples, num_points, optimizer, num_rff_features, maximize, optimizer_kwargs) and returns: pareto_sets,  pareto_fronts