class_docstr: Bijector which computes `Y = g(X) = exp([X 0]) / sum(exp([X 0]))`.
  
  To implement [softmax](https://en.wikipedia.org/wiki/Softmax_function) as a
  bijection, the forward transformation appends a value to the input and the
  inverse removes this coordinate. The appended coordinate represents a pivot,
  e.g., `softmax(x) = exp(x-c) / sum(exp(x-c))` where `c` is the implicit last
  coordinate.
  
  Example Use:
  
  ```python
  bijector.SoftmaxCentered().forward(tf.log([2, 3, 4]))
  # Result: [0.2, 0.3, 0.4, 0.1]
  # Extra result: 0.1
  
  bijector.SoftmaxCentered().inverse([0.2, 0.3, 0.4, 0.1])
  # Result: tf.log([2, 3, 4])
  # Extra coordinate removed.
  ```
  
  At first blush it may seem like the [Invariance of domain](
  https://en.wikipedia.org/wiki/Invariance_of_domain) theorem implies this
  implementation is not a bijection. However, the appended dimension
  makes the (forward) image non-open and the theorem does not directly apply.
class_docstr_tok: ["Bijector","which","computes","`","Y","=","g","(","X",")","=","exp","(","[","X","0","]",")","\/","sum","(","exp","(","[","X","0","]",")",")","`",".","To","implement","[","softmax","]","(","https",":","\/\/en.wikipedia.org\/wiki\/Softmax_function",")","as","a","bijection",",","the","forward","transformation","appends","a","value","to","the","input","and","the","inverse","removes","this","coordinate",".","The","appended","coordinate","represents","a","pivot",",","e.g.",",","`","softmax","(","x",")","=","exp","(","x-c",")","\/","sum","(","exp","(","x-c",")",")","`","where","`","c","`","is","the","implicit","last","coordinate",".","Example","Use",":","``","`","python","bijector.SoftmaxCentered","(",")",".forward","(","tf.log","(","[","2",",","3",",","4","]",")",")","#","Result",":","[","0.2",",","0.3",",","0.4",",","0.1","]","#","Extra","result",":","0.1","bijector.SoftmaxCentered","(",")",".inverse","(","[","0.2",",","0.3",",","0.4",",","0.1","]",")","#","Result",":","tf.log","(","[","2",",","3",",","4","]",")","#","Extra","coordinate","removed",".","``","`","At","first","blush","it","may","seem","like","the","[","Invariance","of","domain","]","(","https",":","\/\/en.wikipedia.org\/wiki\/Invariance_of_domain",")","theorem","implies","this","implementation","is","not","a","bijection",".","However",",","the","appended","dimension","makes","the","(","forward",")","image","non-open","and","the","theorem","does","not","directly","apply","."]
code: def _inverse(self, y):
      # To derive the inverse mapping note that:
      #   y[i] = exp(x[i]) / normalization
      # and
      #   y[end] = 1 / normalization.
      # Thus:
      # x[i] = log(exp(x[i])) - log(y[end]) - log(normalization)
      #      = log(exp(x[i])/normalization) - log(y[end])
      #      = log(y[i]) - log(y[end])
  
      # Do this first to make sure CSE catches that it'll happen again in
      # _inverse_log_det_jacobian.
  
      assertions = []
      if self.validate_args:
          assertions.append(
              assert_util.assert_near(
                  tf.reduce_sum(y, axis=-1),
                  tf.ones([], y.dtype),
                  2.0
                  * np.finfo(dtype_util.as_numpy_dtype(y.dtype)).eps,
                  message="Last dimension of `y` must sum to `1`.",
              )
          )
          assertions.append(
              assert_util.assert_less_equal(
                  y,
                  tf.ones([], y.dtype),
                  message="Elements of `y` must be less than or equal to `1`.",
              )
          )
          assertions.append(
              assert_util.assert_non_negative(
                  y, message="Elements of `y` must be non-negative."
              )
          )
  
      with tf.control_dependencies(assertions):
          x = tf.math.log(y)
          x, log_normalization = tf.split(
              x, num_or_size_splits=[-1, 1], axis=-1
          )
      return x - log_normalization
  
file_path: probability/tensorflow_probability/python/bijectors/softmax_centered.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.bijectors import pad
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
label_desc: Use image node_id 8 for calling the SoftmaxCentered obj's underlying member method code with example usage: obj._inverse(y) and returns: unknown