class_docstr: Tests correctness of the TransformDiagonal bijector.
class_docstr_tok: ["Tests","correctness","of","the","TransformDiagonal","bijector","."]
code: def testBijector(self):
      x = np.float32(np.random.randn(3, 4, 4))
  
      y = x.copy()
      for i in range(x.shape[0]):
          np.fill_diagonal(y[i, :, :], np.exp(np.diag(x[i, :, :])))
  
      diag_bijector = exp.Exp()
      b = transform_diagonal.TransformDiagonal(
          diag_bijector=diag_bijector
      )
  
      y_ = self.evaluate(b.forward(x))
      self.assertAllClose(y, y_)
  
      x_ = self.evaluate(b.inverse(y))
      self.assertAllClose(x, x_)
  
      fldj = self.evaluate(b.forward_log_det_jacobian(x, event_ndims=2))
      ildj = self.evaluate(b.inverse_log_det_jacobian(y, event_ndims=2))
      self.assertAllEqual(
          fldj,
          self.evaluate(
              diag_bijector.forward_log_det_jacobian(
                  np.array([np.diag(x_mat) for x_mat in x]),
                  event_ndims=1,
              )
          ),
      )
      self.assertAllEqual(
          ildj,
          self.evaluate(
              diag_bijector.inverse_log_det_jacobian(
                  np.array([np.diag(y_mat) for y_mat in y]),
                  event_ndims=1,
              )
          ),
      )
  
file_path: probability/tensorflow_probability/python/bijectors/transform_diagonal_test.py
imports: from absl import logging
  import hypothesis
  import hypothesis.strategies
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector_test_util
  from tensorflow_probability.python.bijectors import exp
  from tensorflow_probability.python.bijectors import hypothesis_testlib
  from tensorflow_probability.python.bijectors import normal_cdf
  from tensorflow_probability.python.bijectors import transform_diagonal
  from tensorflow_probability.python.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 1 for calling the TransformDiagonalBijectorTest obj's underlying member method code with example usage: obj.testBijector() without return types