class_docstr: A generic transformation of a posterior (implicitly represented).
class_docstr_tok: ["A","generic","transformation","of","a","posterior","(","implicitly","represented",")","."]
docstr: Sample from the posterior (with gradients).
  
  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])`.
  
  Returns:
      Samples from the posterior, a tensor of shape
      `self._extended_shape(sample_shape=sample_shape)`.
docstr_tok: ["Sample","from","the","posterior","(","with","gradients",")",".","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","]",")","`",".","Returns",":","Samples","from","the","posterior",",","a","tensor","of","shape","`","self._extended_shape","(","sample_shape=sample_shape",")","`","."]
code: def rsample(
      self,
      sample_shape: Optional[torch.Size] = None,
  ) -> Tensor:
      r"""Sample from the posterior (with gradients).
  
      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])`.
  
      Returns:
          Samples from the posterior, a tensor of shape
          `self._extended_shape(sample_shape=sample_shape)`.
      """
      samples = self._posterior.rsample(sample_shape=sample_shape)
      return self._sample_transform(samples)
  
file_path: botorch/botorch/posteriors/transformed.py
imports: from __future__ import annotations
  from typing import Callable, Optional, Tuple
  import torch
  from botorch.posteriors.posterior import Posterior
  from torch import Tensor
label_desc: Use image node_id 10 for calling the TransformedPosterior obj's underlying member method code with example usage: obj.rsample(sample_shape) and returns: self