class_docstr: Bijector that computes `Y = tanh(X)`, therefore `Y in (-1, 1)`.
  
  This can be achieved by an affine transform of the Sigmoid bijector, i.e.,
  it is equivalent to
  ```
  tfb.Chain([tfb.Affine(shift=-1, scale=2.),
             tfb.Sigmoid(),
             tfb.Affine(scale=2.)])
  ```
  
  However, using the `Tanh` bijector directly is slightly faster and more
  numerically stable.
class_docstr_tok: ["Bijector","that","computes","`","Y","=","tanh","(","X",")","`",",","therefore","`","Y","in","(","-1",",","1",")","`",".","This","can","be","achieved","by","an","affine","transform","of","the","Sigmoid","bijector",",","i.e.",",","it","is","equivalent","to","``","`","tfb.Chain","(","[","tfb.Affine","(","shift=-1",",","scale=2",".",")",",","tfb.Sigmoid","(",")",",","tfb.Affine","(","scale=2",".",")","]",")","``","`","However",",","using","the","`","Tanh","`","bijector","directly","is","slightly","faster","and","more","numerically","stable","."]
code: def _inverse(self, y):
      # 0.99999997 is the maximum value such that atanh(x) is valid for both
      # tf.float32 and tf.float64
      y = tf.where(
          tf.less_equal(tf.abs(y), 1.0),
          tf.clip_by_value(y, -0.99999997, 0.99999997),
          y,
      )
      return tf.atanh(y)
  
file_path: agents/tf_agents/distributions/tanh_bijector_stable.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from tensorflow_probability.python.bijectors import bijector
label_desc: Use image node_id 3 for calling the Tanh obj's underlying member method code with example usage: obj._inverse(y) and returns: tf