code: def test_unconstrained_to_corr_cholesky_transform(y_shape):
      transform = transforms.CorrCholeskyTransform()
      y = torch.empty(y_shape).uniform_(-4, 4).requires_grad_()
      x = transform(y)
  
      # test codomain
      assert (transform.codomain.check(x) == 1).all()
  
      # test inv
      y_prime = transform.inv(x)
      assert_tensors_equal(y, y_prime, prec=1e-4)
  
      # test domain
      assert (transform.domain.check(y_prime) == 1).all()
  
      # test log_abs_det_jacobian
      log_det = transform.log_abs_det_jacobian(y, x)
      assert log_det.shape == y_shape[:-1]
      if len(y_shape) == 1:
          triu_index = (
              x.new_ones(x.shape).triu(diagonal=1).to(torch.bool)
          )
          x_tril_vector = x.t()[triu_index]
          assert_tensors_equal(
              _autograd_log_det(x_tril_vector, y), log_det, prec=1e-4
          )
  
          x_tril_vector = x_tril_vector.detach().requires_grad_()
          x = x.new_zeros(x.shape)
          x[triu_index] = x_tril_vector
          x = x.t()
          z = transform.inv(x)
          assert_tensors_equal(
              _autograd_log_det(z, x_tril_vector), -log_det, prec=1e-4
          )
  
file_path: pyro/tests/distributions/test_lkj.py
imports: import math
  import pytest
  import torch
  from torch.distributions import AffineTransform, Beta, TransformedDistribution, biject_to, transform_to
  from pyro.distributions import constraints, transforms
  from pyro.distributions.torch import LKJCholesky
  from tests.common import assert_equal, assert_tensors_equal
label_desc: Use image node_id 3 for calling a global function with example usage: test_unconstrained_to_corr_cholesky_transform(y_shape) without return types