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: Returns a new TanhNormal distribution.
  
  (or populates an existing instance provided by a derived class) with
  batch dimensions expanded to `batch_shape`. This method calls
  :class:`~torch.Tensor.expand` on the distribution's parameters. As
  such, this does not allocate new memory for the expanded distribution
  instance. Additionally, this does not repeat any args checking or
  parameter broadcasting in `__init__.py`, when an instance is first
  created.
  
  Args:
      batch_shape (torch.Size): the desired expanded size.
      _instance(instance): new instance provided by subclasses that
          need to override `.expand`.
  
  Returns:
      Instance: New distribution instance with batch dimensions expanded
      to `batch_size`.
docstr_tok: ["Returns","a","new","TanhNormal","distribution",".","(","or","populates","an","existing","instance","provided","by","a","derived","class",")","with","batch","dimensions","expanded","to","`","batch_shape","`",".","This","method","calls",":","class",":","`","~torch.Tensor.expand","`","on","the","distribution","'s","parameters",".","As","such",",","this","does","not","allocate","new","memory","for","the","expanded","distribution","instance",".","Additionally",",","this","does","not","repeat","any","args","checking","or","parameter","broadcasting","in","`","__init__.py","`",",","when","an","instance","is","first","created",".","Args",":","batch_shape","(","torch.Size",")",":","the","desired","expanded","size",".","_instance","(","instance",")",":","new","instance","provided","by","subclasses","that","need","to","override","`",".expand","`",".","Returns",":","Instance",":","New","distribution","instance","with","batch","dimensions","expanded","to","`","batch_size","`","."]
code: def expand(self, batch_shape, _instance=None):
      """Returns a new TanhNormal distribution.
  
      (or populates an existing instance provided by a derived class) with
      batch dimensions expanded to `batch_shape`. This method calls
      :class:`~torch.Tensor.expand` on the distribution's parameters. As
      such, this does not allocate new memory for the expanded distribution
      instance. Additionally, this does not repeat any args checking or
      parameter broadcasting in `__init__.py`, when an instance is first
      created.
  
      Args:
          batch_shape (torch.Size): the desired expanded size.
          _instance(instance): new instance provided by subclasses that
              need to override `.expand`.
  
      Returns:
          Instance: New distribution instance with batch dimensions expanded
          to `batch_size`.
  
      """
      new_normal = self._normal.expand(batch_shape, _instance)
      new = self._from_distribution(new_normal)
      return new
  
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 9 for calling the TanhNormal obj's underlying member method code with example usage: obj.expand(batch_shape, _instance) and returns: new