code: def pytorch_adapter(fun, in1, in2):
      with torch.cuda.stream(torch_stream):
          tin1 = [
              torch_dlpack.from_dlpack(dltensor) for dltensor in in1
          ]
          tin2 = [
              torch_dlpack.from_dlpack(dltensor) for dltensor in in2
          ]
          tout1, tout2 = fun(tin1, tin2)
          out1, out2 = [
              torch_dlpack.to_dlpack(tout) for tout in tout1
          ], [torch_dlpack.to_dlpack(tout) for tout in tout2]
      torch_stream.synchronize()
      return out1, out2
  
imports: import numpy
  import nvidia.dali.ops
  import nvidia.dali.types
  import os
  import random
  from functools import partial
  from nvidia.dali.pipeline import Pipeline
  from nvidia.dali import fn, pipeline_def
  from nvidia.dali.python_function_plugin import current_dali_stream
label_desc: Use image node_id 5 for calling a global function with example usage: pytorch_adapter(fun, in1, in2) and returns: out1,  out2