class_docstr: Sampler for MC base samples using iid N(0,1) samples.
  
  Example:
      >>> sampler = IIDNormalSampler(1000, seed=1234)
      >>> posterior = model.posterior(test_X)
      >>> samples = sampler(posterior)
class_docstr_tok: ["Sampler","for","MC","base","samples","using","iid","N","(","0,1",")","samples",".","Example",":",">",">",">","sampler","=","IIDNormalSampler","(","1000",",","seed=1234",")",">",">",">","posterior","=","model.posterior","(","test_X",")",">",">",">","samples","=","sampler","(","posterior",")"]
docstr: Generate iid `N(0,1)` base samples (if necessary).
  
  This function will generate a new set of base samples and set the
  `base_samples` buffer if one of the following is true:
  
  - the MCSampler has no `base_samples` attribute.
  - the output of `_get_collapsed_shape` does not agree with the shape of
      `self.base_samples`.
  
  Args:
      posterior: The Posterior for which to generate base samples.
docstr_tok: ["Generate","iid","`","N","(","0,1",")","`","base","samples","(","if","necessary",")",".","This","function","will","generate","a","new","set","of","base","samples","and","set","the","`","base_samples","`","buffer","if","one","of","the","following","is","true",":","-","the","MCSampler","has","no","`","base_samples","`","attribute",".","-","the","output","of","`","_get_collapsed_shape","`","does","not","agree","with","the","shape","of","`","self.base_samples","`",".","Args",":","posterior",":","The","Posterior","for","which","to","generate","base","samples","."]
code: def _construct_base_samples(self, posterior: Posterior) -> None:
      r"""Generate iid `N(0,1)` base samples (if necessary).
  
      This function will generate a new set of base samples and set the
      `base_samples` buffer if one of the following is true:
  
      - the MCSampler has no `base_samples` attribute.
      - the output of `_get_collapsed_shape` does not agree with the shape of
          `self.base_samples`.
  
      Args:
          posterior: The Posterior for which to generate base samples.
      """
      target_shape = self._get_collapsed_shape(posterior=posterior)
      if (
          self.base_samples is None
          or self.base_samples.shape != target_shape
      ):
          with manual_seed(seed=self.seed):
              base_samples = torch.randn(
                  target_shape,
                  device=posterior.device,
                  dtype=posterior.dtype,
              )
          self.register_buffer("base_samples", base_samples)
      if self.base_samples.device != posterior.device:
          self.to(device=posterior.device)  # pragma: nocover
      if self.base_samples.dtype != posterior.dtype:
          self.to(dtype=posterior.dtype)
  
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 1 for calling the IIDNormalSampler obj's underlying member method code with example usage: obj._construct_base_samples(posterior) without return types