class_docstr: Tests the correctness of the Y = X @ X.T transformation.
class_docstr_tok: ["Tests","the","correctness","of","the","Y","=","X","@","X.T","transformation","."]
code: def testBijectorMatrix(self):
      bijector = cholesky_outer_product.CholeskyOuterProduct(
          validate_args=True
      )
      self.assertStartsWith(bijector.name, "cholesky_outer_product")
      x = [[[1.0, 0], [2, 1]], [[np.sqrt(2.0), 0], [np.sqrt(8.0), 1]]]
      y = np.matmul(x, np.transpose(x, axes=(0, 2, 1)))
      # Fairly easy to compute differentials since we have 2x2.
      dx_dy = [
          [[2.0 * 1, 0, 0], [2, 1, 0], [0, 2 * 2, 2 * 1]],
          [
              [2 * np.sqrt(2.0), 0, 0],
              [np.sqrt(8.0), np.sqrt(2.0), 0],
              [0, 2 * np.sqrt(8.0), 2 * 1],
          ],
      ]
      ildj = -np.sum(
          np.log(
              np.asarray(dx_dy).diagonal(offset=0, axis1=1, axis2=2)
          ),
          axis=1,
      )
      self.assertAllEqual((2, 2, 2), bijector.forward(x).shape)
      self.assertAllEqual((2, 2, 2), bijector.inverse(y).shape)
      self.assertAllClose(y, self.evaluate(bijector.forward(x)))
      self.assertAllClose(x, self.evaluate(bijector.inverse(y)))
      self.assertAllClose(
          ildj,
          self.evaluate(
              bijector.inverse_log_det_jacobian(y, event_ndims=2)
          ),
          atol=0.0,
          rtol=1e-7,
      )
      self.assertAllClose(
          self.evaluate(
              -bijector.inverse_log_det_jacobian(y, event_ndims=2)
          ),
          self.evaluate(
              bijector.forward_log_det_jacobian(x, event_ndims=2)
          ),
          atol=0.0,
          rtol=1e-7,
      )
  
file_path: probability/tensorflow_probability/python/bijectors/cholesky_outer_product_test.py
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import cholesky_outer_product
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 1 for calling the CholeskyOuterProductBijectorTest obj's underlying member method code with example usage: obj.testBijectorMatrix() without return types