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: The log likelihood of a sample on the this Tanh Distribution.
  
  Args:
      value (torch.Tensor): The sample whose loglikelihood is being
          computed.
      pre_tanh_value (torch.Tensor): The value prior to having the tanh
          function applied to it but after it has been sampled from the
          normal distribution.
      epsilon (float): Regularization constant. Making this value larger
          makes the computation more stable but less precise.
  
  Note:
        when pre_tanh_value is None, an estimate is made of what the
        value is. This leads to a worse estimation of the log_prob.
        If the value being used is collected from functions like
        `sample` and `rsample`, one can instead use functions like
        `sample_return_pre_tanh_value` or
        `rsample_return_pre_tanh_value`
  
  
  Returns:
      torch.Tensor: The log likelihood of value on the distribution.
docstr_tok: ["The","log","likelihood","of","a","sample","on","the","this","Tanh","Distribution",".","Args",":","value","(","torch.Tensor",")",":","The","sample","whose","loglikelihood","is","being","computed",".","pre_tanh_value","(","torch.Tensor",")",":","The","value","prior","to","having","the","tanh","function","applied","to","it","but","after","it","has","been","sampled","from","the","normal","distribution",".","epsilon","(","float",")",":","Regularization","constant",".","Making","this","value","larger","makes","the","computation","more","stable","but","less","precise",".","Note",":","when","pre_tanh_value","is","None",",","an","estimate","is","made","of","what","the","value","is",".","This","leads","to","a","worse","estimation","of","the","log_prob",".","If","the","value","being","used","is","collected","from","functions","like","`","sample","`","and","`","rsample","`",",","one","can","instead","use","functions","like","`","sample_return_pre_tanh_value","`","or","`","rsample_return_pre_tanh_value","`","Returns",":","torch.Tensor",":","The","log","likelihood","of","value","on","the","distribution","."]
code: def log_prob(self, value, pre_tanh_value=None, epsilon=1e-6):
      """The log likelihood of a sample on the this Tanh Distribution.
  
      Args:
          value (torch.Tensor): The sample whose loglikelihood is being
              computed.
          pre_tanh_value (torch.Tensor): The value prior to having the tanh
              function applied to it but after it has been sampled from the
              normal distribution.
          epsilon (float): Regularization constant. Making this value larger
              makes the computation more stable but less precise.
  
      Note:
            when pre_tanh_value is None, an estimate is made of what the
            value is. This leads to a worse estimation of the log_prob.
            If the value being used is collected from functions like
            `sample` and `rsample`, one can instead use functions like
            `sample_return_pre_tanh_value` or
            `rsample_return_pre_tanh_value`
  
  
      Returns:
          torch.Tensor: The log likelihood of value on the distribution.
  
      """
      # pylint: disable=arguments-differ
      if pre_tanh_value is None:
          pre_tanh_value = (
              torch.log((1 + epsilon + value) / (1 + epsilon - value))
              / 2
          )
      norm_lp = self._normal.log_prob(pre_tanh_value)
      ret = norm_lp - torch.sum(
          torch.log(
              self._clip_but_pass_gradient((1.0 - value**2)) + epsilon
          ),
          axis=-1,
      )
      return ret
  
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 2 for calling the TanhNormal obj's underlying member method code with example usage: obj.log_prob(value, pre_tanh_value, epsilon) and returns: ret