code: def use_torch(gpu):
      global torch
      global datapy
      global _to_numpy
      global cast_to
      import torch
  
      datapy = torch
  
      def torch2numpy(tensor):
          return np.array(tensor.cpu())
  
      _to_numpy = torch2numpy
      global random_array
  
      def make_torch_tensor(*args, **kwargs):
          t = torch.tensor(*args, **kwargs)
          return t.cuda() if gpu else t
  
      def torch_cast(x, dtype):
          return x.type(dtype)
  
      cast_to = torch_cast
  
      def random_array(shape):
          return make_torch_tensor(np.random.ranf(shape))
  
      global make_array
  
      make_array = make_torch_tensor
      global cpu_input
      cpu_input = not gpu
  
imports: import functools
  import numpy
  import nvidia.dali.fn
  import nvidia.dali.ops
  from nvidia.dali import Pipeline
  from nose_utils import assert_raises
  from test_utils import check_output
label_desc: Use image node_id 5 for calling a global function with example usage: use_torch(gpu) and returns: np, unknown, x, make_torch_tensor