code: def test_sample_optimal_points(self):
      torch.manual_seed(1)
      input_dim = 3
      num_initial = 5
      tkwargs = {"device": self.device}
      optimizer_kwargs = {
          "pop_size": 100,
          "max_tries": 1,
      }
      num_samples = 2
      num_points = 1
  
      for (
          dtype,
          maximize,
          num_objectives,
          opt_kwargs,
          use_model_list,
          standardize_model,
      ) in product(
          (torch.float, torch.double),
          (True, False),
          (1, 2),
          (optimizer_kwargs, None),
          (False, True),
          (False, True),
      ):
          tkwargs["dtype"] = dtype
  
          model, X, Y = get_model(
              num_points=num_initial,
              input_dim=input_dim,
              num_objectives=num_objectives,
              use_model_list=use_model_list,
              standardize_model=standardize_model,
              **tkwargs,
          )
  
          input_dim = X.shape[-1]
          bounds = torch.zeros((2, input_dim), **tkwargs)
          bounds[1] = 1.0
  
          # check the error when asking for too many optimal points
          if num_objectives == 1:
              with self.assertRaises(UnsupportedError):
                  sample_optimal_points(
                      model=model,
                      bounds=bounds,
                      num_samples=num_samples,
                      num_points=2,
                      maximize=maximize,
                      optimizer=random_search_optimizer,
                      optimizer_kwargs=opt_kwargs,
                  )
  
          pareto_sets, pareto_fronts = sample_optimal_points(
              model=model,
              bounds=bounds,
              num_samples=num_samples,
              num_points=num_points,
              maximize=maximize,
              optimizer=random_search_optimizer,
              optimizer_kwargs=opt_kwargs,
          )
  
          # check shape
          ps_desired_shape = torch.Size(
              [num_samples, num_points, input_dim]
          )
          pf_desired_shape = torch.Size(
              [num_samples, num_points, num_objectives]
          )
  
          self.assertTrue(pareto_sets.shape == ps_desired_shape)
          self.assertTrue(pareto_fronts.shape == pf_desired_shape)
  
imports: import warnings
  from itertools import product
  from unittest import mock
  import torch
  from botorch.acquisition.multi_objective.objective import MCMultiOutputObjective, UnstandardizeMCMultiOutputObjective
  from botorch.acquisition.multi_objective.utils import compute_sample_box_decomposition, get_default_partitioning_alpha, prune_inferior_points_multi_objective, random_search_optimizer, sample_optimal_points
  from botorch.exceptions.errors import UnsupportedError
  from botorch.models.gp_regression import SingleTaskGP
  from botorch.models.model_list_gp_regression import ModelListGP
  from botorch.models.transforms.outcome import Standardize
  from botorch.utils.gp_sampling import get_gp_samples
  from botorch.utils.multi_objective import is_non_dominated
  from botorch.utils.testing import BotorchTestCase, MockModel, MockPosterior
  from torch import Tensor
label_desc: Use image node_id 2 for calling the TestThompsonSampling obj's underlying member method code with example usage: obj.test_sample_optimal_points() without return types