class_docstr: Base class for samplers producing (possibly QMC) N(0,1) samples.
  
  Subclasses must implement the `_construct_base_samples` method.
class_docstr_tok: ["Base","class","for","samplers","producing","(","possibly","QMC",")","N","(","0,1",")","samples",".","Subclasses","must","implement","the","`","_construct_base_samples","`","method","."]
docstr: Update the sampler to use the original base samples for X_baseline.
  
  This is used in CachedCholeskyAcquisitionFunctions to ensure consistency.
  
  Args:
      posterior: The posterior for which the base samples are constructed.
      base_sampler: The base sampler to retrieve the base samples from.
docstr_tok: ["Update","the","sampler","to","use","the","original","base","samples","for","X_baseline",".","This","is","used","in","CachedCholeskyAcquisitionFunctions","to","ensure","consistency",".","Args",":","posterior",":","The","posterior","for","which","the","base","samples","are","constructed",".","base_sampler",":","The","base","sampler","to","retrieve","the","base","samples","from","."]
code: def _update_base_samples(
      self, posterior: Posterior, base_sampler: NormalMCSampler
  ) -> None:
      r"""Update the sampler to use the original base samples for X_baseline.
  
      This is used in CachedCholeskyAcquisitionFunctions to ensure consistency.
  
      Args:
          posterior: The posterior for which the base samples are constructed.
          base_sampler: The base sampler to retrieve the base samples from.
      """
      self._instance_check(base_sampler=base_sampler)
      self._construct_base_samples(posterior=posterior)
      if base_sampler.base_samples is not None:
          current_base_samples = (
              base_sampler.base_samples.detach().clone()
          )
          # This is the # of non-`sample_shape` dimensions.
          base_ndims = current_base_samples.dim() - 1
          # Unsqueeze as many dimensions as needed to match target_shape.
          target_shape = self._get_collapsed_shape(posterior=posterior)
          view_shape = (
              self.sample_shape
              + torch.Size(
                  [1] * (len(target_shape) - current_base_samples.dim())
              )
              + current_base_samples.shape[-base_ndims:]
          )
          expanded_shape = (
              target_shape[:-base_ndims]
              + current_base_samples.shape[-base_ndims:]
          )
          # Use stored base samples:
          # Use all base_samples from the current sampler
          # this includes the base_samples from the base_sampler
          # and any base_samples for the new points in the sampler.
          # For example, when using sequential greedy candidate generation
          # then generate the new candidate point using last (-1) base_sample
          # in sampler. This copies that base sample.
          expanded_samples = current_base_samples.view(
              view_shape
          ).expand(expanded_shape)
          if isinstance(
              posterior, (HigherOrderGPPosterior, MultitaskGPPosterior)
          ):
              n_train_samples = current_base_samples.shape[-1] // 2
              # The train base samples.
              self.base_samples[
                  ..., :n_train_samples
              ] = expanded_samples[..., :n_train_samples]
              # The train noise base samples.
              self.base_samples[
                  ..., -n_train_samples:
              ] = expanded_samples[..., -n_train_samples:]
          else:
              batch_shape = (
                  posterior._posterior.batch_shape
                  if isinstance(posterior, TransformedPosterior)
                  else posterior.batch_shape
              )
              single_output = (
                  len(posterior.base_sample_shape) - len(batch_shape)
              ) == 1
              if single_output:
                  self.base_samples[
                      ..., : current_base_samples.shape[-1]
                  ] = expanded_samples
              else:
                  self.base_samples[
                      ..., : current_base_samples.shape[-2], :
                  ] = expanded_samples
  
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  import torch
  from botorch.exceptions import UnsupportedError
  from botorch.posteriors import Posterior
  from botorch.posteriors.higher_order import HigherOrderGPPosterior
  from botorch.posteriors.multitask import MultitaskGPPosterior
  from botorch.posteriors.transformed import TransformedPosterior
  from botorch.sampling.base import MCSampler
  from botorch.utils.sampling import draw_sobol_normal_samples, manual_seed
  from torch import Tensor
  from torch.quasirandom import SobolEngine
label_desc: Use image node_id 3 for calling the NormalMCSampler obj's underlying member method code with example usage: obj._update_base_samples(posterior, base_sampler) without return types