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: Clipping function that allows for gradients to flow through.
  
  Args:
      x (torch.Tensor): value to be clipped
      lower (float): lower bound of clipping
      upper (float): upper bound of clipping
  
  Returns:
      torch.Tensor: x clipped between lower and upper.
docstr_tok: ["Clipping","function","that","allows","for","gradients","to","flow","through",".","Args",":","x","(","torch.Tensor",")",":","value","to","be","clipped","lower","(","float",")",":","lower","bound","of","clipping","upper","(","float",")",":","upper","bound","of","clipping","Returns",":","torch.Tensor",":","x","clipped","between","lower","and","upper","."]
code: def _clip_but_pass_gradient(x, lower=0.0, upper=1.0):
      """Clipping function that allows for gradients to flow through.
  
      Args:
          x (torch.Tensor): value to be clipped
          lower (float): lower bound of clipping
          upper (float): upper bound of clipping
  
      Returns:
          torch.Tensor: x clipped between lower and upper.
  
      """
      clip_up = (x > upper).float()
      clip_low = (x < lower).float()
      with torch.no_grad():
          clip = (upper - x) * clip_up + (lower - x) * clip_low
      return x + clip
  
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 14 for calling the TanhNormal obj's underlying member method code with example usage: obj._clip_but_pass_gradient(x, lower, upper) and returns: unknown