class_docstr: Tests correctness of the Y = g(X) = X / norm(X) transformation.
class_docstr_tok: ["Tests","correctness","of","the","Y","=","g","(","X",")","=","X","\/","norm","(","X",")","transformation","."]
code: def testBijectorVector(self):
      uv = unit_vector.UnitVector()
      self.assertStartsWith(uv.name, "unit_vector")
      x = np.array([[2.0, 1.0, 2.0], [0.0, 3.0, 0.0]])
      y = np.array([[0.4, 0.2, 0.4, 0.8], [0, 0.6, 0, 0.8]])
      self.assertAllClose(y, self.evaluate(uv.forward(x)))
      self.assertAllClose(x, self.evaluate(uv.inverse(y)))
      self.assertAllClose(
          3 * np.log(2) - 3 * np.log([10, 10]),
          self.evaluate(uv.forward_log_det_jacobian(x, event_ndims=1)),
          atol=0.0,
          rtol=1e-7,
      )
      self.assertAllClose(
          self.evaluate(-uv.inverse_log_det_jacobian(y, event_ndims=1)),
          self.evaluate(uv.forward_log_det_jacobian(x, event_ndims=1)),
          atol=0.0,
          rtol=1e-7,
      )
  
file_path: probability/tensorflow_probability/python/bijectors/unit_vector_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 unit_vector
  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 UnitVectorBijectorTest obj's underlying member method code with example usage: obj.testBijectorVector() without return types