class_docstr: Tests correctness of the Y = g(X) = exp(X) / sum(exp(X)) transformation.
class_docstr_tok: ["Tests","correctness","of","the","Y","=","g","(","X",")","=","exp","(","X",")","\/","sum","(","exp","(","X",")",")","transformation","."]
code: def testBijectorVector(self):
      softmax = softmax_centered.SoftmaxCentered()
      self.assertStartsWith(softmax.name, "softmax_centered")
      x = np.log([[2.0, 3, 4], [4.0, 8, 12]])
      y = [[0.2, 0.3, 0.4, 0.1], [0.16, 0.32, 0.48, 0.04]]
      self.assertAllClose(y, self.evaluate(softmax.forward(x)))
      self.assertAllClose(x, self.evaluate(softmax.inverse(y)))
      self.assertAllClose(
          -np.sum(np.log(y), axis=1)
          - 0.5 * np.log(4.0)[np.newaxis, ...],
          self.evaluate(
              softmax.inverse_log_det_jacobian(y, event_ndims=1)
          ),
          atol=0.0,
          rtol=1e-7,
      )
      self.assertAllClose(
          self.evaluate(
              -softmax.inverse_log_det_jacobian(y, event_ndims=1)
          ),
          self.evaluate(
              softmax.forward_log_det_jacobian(x, event_ndims=1)
          ),
          atol=0.0,
          rtol=1e-7,
      )
  
file_path: probability/tensorflow_probability/python/bijectors/softmax_centered_test.py
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector_test_util
  from tensorflow_probability.python.bijectors import softmax_centered
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 1 for calling the SoftmaxCenteredBijectorTest obj's underlying member method code with example usage: obj.testBijectorVector() without return types