code: def test_transform_to(constraint_fn, args, is_cuda):
      constraint = build_constraint(
          constraint_fn, args, is_cuda=is_cuda
      )
      t = transform_to(constraint)
      if constraint_fn is constraints.corr_cholesky:
          # (D * (D-1)) / 2 (where D = 4) = 6 (size of last dim)
          x = torch.randn(6, 6, dtype=torch.double)
      else:
          x = torch.randn(5, 5, dtype=torch.double)
      if is_cuda:
          x = x.cuda()
      y = t(x)
      assert constraint.check(
          y
      ).all(), f"Failed to transform_to({constraint})"
      x2 = t.inv(y)
      y2 = t(x2)
      assert torch.allclose(
          y, y2
      ), f"Error in transform_to({constraint}) pseudoinverse"
  
file_path: pytorch/test/distributions/test_constraints.py
imports: import pytest
  import torch
  from torch.distributions import biject_to, constraints, transform_to
  from torch.testing._internal.common_cuda import TEST_CUDA
  from torch.testing._internal.common_utils import run_tests
label_desc: Use image node_id 4 for calling a global function with example usage: test_transform_to(constraint_fn, args, is_cuda) without return types