code: def cupy_compare(fun, synchronize, pre1, pre2, post1, post2):
      cupy_pre1 = [cupy.asarray(pre1.at(i)) for i in range(BATCH_SIZE)]
      cupy_pre2 = [cupy.asarray(pre2.at(i)) for i in range(BATCH_SIZE)]
      if synchronize:
          cupy_post1, cupy_post2 = fun(cupy_pre1, cupy_pre2)
      else:
          stream = cupy.cuda.Stream()
          cupy_post1, cupy_post2 = fun(
              cupy_pre1, cupy_pre2, stream=stream
          )
          stream.synchronize()
      for i in range(BATCH_SIZE):
          assert post1.at(i).shape == cupy_post1[i].shape
          assert post2.at(i).shape == cupy_post2[i].shape
          assert numpy.array_equal(
              post1.at(i), cupy.asnumpy(cupy_post1[i])
          )
          assert numpy.array_equal(
              post2.at(i), cupy.asnumpy(cupy_post2[i])
          )
  
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 24 for calling a global function with example usage: cupy_compare(fun, synchronize, pre1, pre2, post1, post2) without return types