code: def convert_to_torch(tensor, device="cuda", dtype=None, size=None):
      if size is None:
          if isinstance(tensor, TensorListCPU) or isinstance(
              tensor, TensorListGPU
          ):
              t = tensor.as_tensor()
          else:
              t = tensor
          size = t.shape()
      dali_torch_tensor = torch.empty(
          size=size, device=device, dtype=dtype
      )
      c_type_pointer = ctypes.c_void_p(dali_torch_tensor.data_ptr())
      tensor.copy_to_external(c_type_pointer)
      return dali_torch_tensor
  
imports: from nvidia.dali.tensors import TensorCPU, TensorGPU, TensorListCPU, TensorListGPU
  import nvidia.dali.tensors
  import numpy
  import torch
  from torch.utils.dlpack import to_dlpack
  import ctypes
  from nvidia.dali.backend import CheckDLPackCapsule
label_desc: Use image node_id 1 for calling a global function with example usage: convert_to_torch(tensor, device, dtype, size) and returns: dali_torch_tensor