code: def update_map(mode, shape, nimages=1):
      """
      Code for map calculation.
      Based on https://github.com/opencv/opencv/blob/3.4/samples/python/tutorial_code/ImgTrans/remap/Remap_Demo.py  # noqa
      :param mode: One of: 'identity', 'xflip', 'yflip', 'xyflip', 'random'
      :param shape: HWC shape of a sample.
      :param nimages: Number of maps to be generated for every axis.
      :return: tuple of 2 ndarrays (mapx: [nimages, H, W, C], mapy: [nimages, H, W, C])
      """
      mapsx = []
      mapsy = []
      for _ in range(nimages):
          map_x = np.tile(np.arange(shape[1]), [shape[0], 1])
          map_y = np.tile(
              np.arange(shape[0])[:, np.newaxis], [1, shape[1]]
          )
          if mode == "identity":
              pass
          elif mode == "xflip":
              map_x = shape[1] - map_x
          elif mode == "yflip":
              map_y = shape[0] - map_y
          elif mode == "xyflip":
              map_x = shape[1] - map_x
              map_y = shape[0] - map_y
          elif mode == "random":
              map_x = rng.uniform(
                  low=0, high=map_x.shape[1] + 0, size=shape
              )
              map_y = rng.uniform(
                  low=0, high=map_y.shape[0] + 0, size=shape
              )
          else:
              raise ValueError("Unknown map mode.")
          mapsx.append(map_x)
          mapsy.append(map_y)
      return np.array(mapsx, dtype=np.float32), np.array(
          mapsy, dtype=np.float32
      )
  
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 1 for calling a global function with example usage: update_map(mode, shape, nimages) and returns: np,  np