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 __init__(self, validate_args=False, name="softmax_centered"):
      parameters = dict(locals())
      with tf.name_scope(name) as name:
          self._pad = pad_lib.Pad(validate_args=validate_args)
          super(SoftmaxCentered, self).__init__(
              forward_min_event_ndims=1,
              validate_args=validate_args,
              parameters=parameters,
              name=name,
          )
  
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 1 to create a new SoftmaxCentered object from inherited base classes: bijector with example: obj = SoftmaxCentered(validate_args, name)