code: def gridmask(images, widths, heights):
      p = dali.fn.random.coin_flip()
      ratio = 0.4 * p
      angle = (
          dali.fn.random.normal(mean=-1, stddev=1)
          * 10.0
          * (math.pi / 180.0)
      )
  
      l = dali.math.min(0.5 * heights, 0.3 * widths)
      r = dali.math.max(0.5 * heights, 0.3 * widths)
      tile = dali.fn.cast(
          (dali.fn.random.uniform(range=[0.0, 1.0]) * (r - l) + l),
          dtype=dali.types.INT32,
      )
  
      gridmask = dali.fn.grid_mask(
          images, ratio=ratio, angle=angle, tile=tile
      )
  
      return images
  
imports: import math
  import nvidia.dali
label_desc: Use image node_id 4 for calling a global function with example usage: gridmask(images, widths, heights) and returns: images