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 testBijectorUnknownShape(self):
      uv = unit_vector.UnitVector()
      x_ = np.array(
          [[2.0, 1.0, 2.0], [0.0, 3.0, 0.0]], dtype=np.float32
      )
      y_ = np.array(
          [[0.4, 0.2, 0.4, 0.8], [0, 0.6, 0, 0.8]],
          dtype=np.float32,
      )
      x = tf1.placeholder_with_default(x_, shape=[2, None])
      y = tf1.placeholder_with_default(y_, shape=[2, None])
      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-6,
      )
      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-6,
      )
  
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 2 for calling the UnitVectorBijectorTest obj's underlying member method code with example usage: obj.testBijectorUnknownShape() without return types