class_docstr: Abstract base class for botorch posteriors.
  
  :meta private:
class_docstr_tok: ["Abstract","base","class","for","botorch","posteriors",".",":","meta","private",":"]
docstr: Sample from the posterior (with gradients) using base samples.
  
  This is intended to be used with a sampler that produces the corresponding base
  samples, and enables acquisition optimization via Sample Average Approximation.
  
  Args:
      sample_shape: A `torch.Size` object specifying the sample shape. To
          draw `n` samples, set to `torch.Size([n])`. To draw `b` batches
          of `n` samples each, set to `torch.Size([b, n])`.
      base_samples: The base samples, obtained from the appropriate sampler.
          This is a tensor of shape `sample_shape x base_sample_shape`.
  
  Returns:
      Samples from the posterior, a tensor of shape
      `self._extended_shape(sample_shape=sample_shape)`.
docstr_tok: ["Sample","from","the","posterior","(","with","gradients",")","using","base","samples",".","This","is","intended","to","be","used","with","a","sampler","that","produces","the","corresponding","base","samples",",","and","enables","acquisition","optimization","via","Sample","Average","Approximation",".","Args",":","sample_shape",":","A","`","torch.Size","`","object","specifying","the","sample","shape",".","To","draw","`","n","`","samples",",","set","to","`","torch.Size","(","[","n","]",")","`",".","To","draw","`","b","`","batches","of","`","n","`","samples","each",",","set","to","`","torch.Size","(","[","b",",","n","]",")","`",".","base_samples",":","The","base","samples",",","obtained","from","the","appropriate","sampler",".","This","is","a","tensor","of","shape","`","sample_shape","x","base_sample_shape","`",".","Returns",":","Samples","from","the","posterior",",","a","tensor","of","shape","`","self._extended_shape","(","sample_shape=sample_shape",")","`","."]
code: def rsample_from_base_samples(
      self,
      sample_shape: torch.Size,
      base_samples: Tensor,
  ) -> Tensor:
      r"""Sample from the posterior (with gradients) using base samples.
  
      This is intended to be used with a sampler that produces the corresponding base
      samples, and enables acquisition optimization via Sample Average Approximation.
  
      Args:
          sample_shape: A `torch.Size` object specifying the sample shape. To
              draw `n` samples, set to `torch.Size([n])`. To draw `b` batches
              of `n` samples each, set to `torch.Size([b, n])`.
          base_samples: The base samples, obtained from the appropriate sampler.
              This is a tensor of shape `sample_shape x base_sample_shape`.
  
      Returns:
          Samples from the posterior, a tensor of shape
          `self._extended_shape(sample_shape=sample_shape)`.
      """
      raise NotImplementedError(
          f"{self.__class__.__name__} does not implement `rsample_from_base_samples`."
      )
  
file_path: botorch/botorch/posteriors/posterior.py
imports: from __future__ import annotations
  import warnings
  from abc import ABC, abstractmethod, abstractproperty
  from typing import Optional, Tuple
  import torch
  from torch import Tensor
label_desc: Use image node_id 1 for calling the Posterior obj's underlying member method code with example usage: obj.rsample_from_base_samples(sample_shape, base_samples) without return types