code: def get_optimal_samples(
      model: Model,
      bounds: Tensor,
      num_optima: int,
      raw_samples: int = 1024,
      num_restarts: int = 20,
      maximize: bool = True,
  ) -> Tuple[Tensor, Tensor]:
      """Draws sample paths from the posterior and maximizes the samples using GD.
  
      Args:
          model (Model): The model from which samples are drawn.
          bounds: (Tensor): Bounds of the search space. If the model inputs are
              normalized, the bounds should be normalized as well.
          num_optima (int): The number of paths to be drawn and optimized.
          raw_samples (int, optional): The number of candidates randomly sample.
              Defaults to 1024.
          num_restarts (int, optional): The number of candidates to do gradient-based
              optimization on. Defaults to 20.
          maximize: Whether to maximize or minimize the samples.
      Returns:
          Tuple[Tensor, Tensor]: The optimal input locations and corresponding
          outputs, x* and f*.
  
      """
      paths = draw_matheron_paths(
          model, sample_shape=torch.Size([num_optima])
      )
      optimal_inputs, optimal_outputs = optimize_posterior_samples(
          paths,
          bounds=bounds,
          raw_samples=raw_samples,
          num_restarts=num_restarts,
          maximize=maximize,
      )
      return optimal_inputs, optimal_outputs
  
imports: from __future__ import annotations
  import math
  from typing import Callable, Dict, List, Optional, Tuple
  import torch
  from botorch.acquisition.objective import IdentityMCObjective, MCAcquisitionObjective, PosteriorTransform
  from botorch.exceptions.errors import BotorchTensorDimensionError, DeprecationError, UnsupportedError
  from botorch.models.fully_bayesian import MCMC_DIM
  from botorch.models.model import Model
  from botorch.sampling.base import MCSampler
  from botorch.sampling.get_sampler import get_sampler
  from botorch.sampling.pathwise import draw_matheron_paths
  from botorch.utils.objective import compute_feasibility_indicator
  from botorch.utils.sampling import optimize_posterior_samples
  from botorch.utils.transforms import is_ensemble, normalize_indices
  from torch import Tensor
label_desc: Use image node_id 10 for calling a global function with example usage: get_optimal_samples(model, bounds, num_optima, raw_samples, num_restarts, maximize) and returns: optimal_inputs,  optimal_outputs