code: def remap_pipe(remap_op, maps_data, img_size):
      """
      Returns either a reference pipeline or a pipeline under test.
  
      If the remap_op argument is 'dali', this function returns a DALI pipeline under test.
      If the remap_op argument is 'cv', this function returns a reference DALI pipeline.
  
      :param remap_op: 'dali' or 'cv'.
      :param maps_data: List of ndarrays, which contains data for the remap parameters (maps).
      :param img_size: Shape of the remap parameters, but without the channels value (only spatial).
      :return: DALI Pipeline
      """
      img, _ = fn.readers.file(file_root=data_dir)
      img = fn.decoders.image(img)
      img = fn.resize(img, size=img_size)
      mapx, mapy = fn.external_source(
          source=maps_data, batch=True, cycle=True, num_outputs=2
      )
      if remap_op == "dali":
          return fn.experimental.remap(
              img.gpu(),
              mapx.gpu(),
              mapy.gpu(),
              interp=DALIInterpType.INTERP_NN,
              device="gpu",
              pixel_origin="center",
          )
      elif remap_op == "cv":
          return fn.python_function(img, mapx, mapy, function=_cv_remap)
      else:
          raise ValueError("Unknown remap operator.")
  
imports: import cv2
  import numpy
  import nvidia.dali
  import nvidia.dali.fn
  import os.path
  import unittest
  import time
  from nose2.tools import params
  from nvidia.dali.pipeline.experimental import pipeline_def
  from nvidia.dali.types import DALIInterpType
label_desc: Use image node_id 3 for calling a global function with example usage: remap_pipe(remap_op, maps_data, img_size) and returns: fn, fn