class_docstr: A distribution induced by applying a tanh transformation to a Gaussian random variable.
  
  Algorithms like SAC and Pearl use this transformed distribution.
  It can be thought of as a distribution of X where
      :math:`Y ~ \mathcal{N}(\mu, \sigma)`
      :math:`X = tanh(Y)`
  
  Args:
      loc (torch.Tensor): The mean of this distribution.
      scale (torch.Tensor): The stdev of this distribution.
class_docstr_tok: ["A","distribution","induced","by","applying","a","tanh","transformation","to","a","Gaussian","random","variable",".","Algorithms","like","SAC","and","Pearl","use","this","transformed","distribution",".","It","can","be","thought","of","as","a","distribution","of","X","where",":","math",":","`","Y","~","\\mathcal","{","N","}","(","\\mu",",","\\sigma",")","`",":","math",":","`","X","=","tanh","(","Y",")","`","Args",":","loc","(","torch.Tensor",")",":","The","mean","of","this","distribution",".","scale","(","torch.Tensor",")",":","The","stdev","of","this","distribution","."]
docstr: Return a sample, sampled from this TanhNormal distribution.
  
  Returns the sampled value before the tanh transform is applied and the
  sampled value with the tanh transform applied to it.
  
  Args:
      sample_shape (list): shape of the return.
  
  Note:
      Gradients pass through this operation.
  
  Returns:
      torch.Tensor: Samples from this distribution.
      torch.Tensor: Samples from the underlying
          :obj:`torch.distributions.Normal` distribution, prior to being
          transformed with `tanh`.
docstr_tok: ["Return","a","sample",",","sampled","from","this","TanhNormal","distribution",".","Returns","the","sampled","value","before","the","tanh","transform","is","applied","and","the","sampled","value","with","the","tanh","transform","applied","to","it",".","Args",":","sample_shape","(","list",")",":","shape","of","the","return",".","Note",":","Gradients","pass","through","this","operation",".","Returns",":","torch.Tensor",":","Samples","from","this","distribution",".","torch.Tensor",":","Samples","from","the","underlying",":","obj",":","`","torch.distributions.Normal","`","distribution",",","prior","to","being","transformed","with","`","tanh","`","."]
code: def rsample_with_pre_tanh_value(self, sample_shape=torch.Size()):
      """Return a sample, sampled from this TanhNormal distribution.
  
      Returns the sampled value before the tanh transform is applied and the
      sampled value with the tanh transform applied to it.
  
      Args:
          sample_shape (list): shape of the return.
  
      Note:
          Gradients pass through this operation.
  
      Returns:
          torch.Tensor: Samples from this distribution.
          torch.Tensor: Samples from the underlying
              :obj:`torch.distributions.Normal` distribution, prior to being
              transformed with `tanh`.
  
      """
      z = self._normal.rsample(sample_shape)
      return z, torch.tanh(z)
  
file_path: garage/src/garage/torch/distributions/tanh_normal.py
imports: import torch
  from torch.distributions import Normal
  from torch.distributions.independent import Independent
label_desc: Use image node_id 5 for calling the TanhNormal obj's underlying member method code with example usage: obj.rsample_with_pre_tanh_value(sample_shape) and returns: z,  torch