class_docstr: A sampler that calls `posterior.rsample_from_base_samples` to
  generate the samples via index base samples.
docstr: Constructs base samples as indices to sample with them from
  the Posterior.
  
  Args:
      posterior: The ensemble posterior to construct the base samples
          for.
code: def _construct_base_samples(
      self, posterior: EnsemblePosterior
  ) -> None:
      r"""Constructs base samples as indices to sample with them from
      the Posterior.
  
      Args:
          posterior: The ensemble posterior to construct the base samples
              for.
      """
      if (
          self.base_samples is None
          or self.base_samples.shape != self.sample_shape
      ):
          with torch.random.fork_rng():
              torch.manual_seed(self.seed)
              base_samples = torch.multinomial(
                  posterior.weights,
                  num_samples=self.sample_shape.numel(),
                  replacement=True,
              ).reshape(self.sample_shape)
          self.register_buffer("base_samples", base_samples)
      if self.base_samples.device != posterior.device:
          self.to(device=posterior.device)
  
file_path: botorch/botorch/sampling/index_sampler.py
imports: from __future__ import annotations
  import torch
  from botorch.posteriors.ensemble import EnsemblePosterior
  from botorch.sampling.base import MCSampler
  from torch import Tensor
label_desc: Use image node_id 2 for calling the IndexSampler obj's underlying member method code with example usage: obj._construct_base_samples(posterior) without return types