code: def build_constraint(constraint_fn, args, is_cuda=False):
      if not args:
          return constraint_fn
      t = torch.cuda.DoubleTensor if is_cuda else torch.DoubleTensor
      return constraint_fn(
          *(t(x) if isinstance(x, list) else x for x in args)
      )
  
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 1 for calling a global function with example usage: build_constraint(constraint_fn, args, is_cuda) and returns: constraint_fn, constraint_fn