code: def get_mask(w, h, tile, ratio, angle, d):
      ca = math.cos(angle)
      sa = math.sin(angle)
      b = tile * ratio
  
      i = np.tile(np.arange(w), (h, 1))
      j = np.transpose(np.tile(np.arange(h), (w, 1)))
      x = i * ca - j * sa
      y = i * sa + j * ca
      m = np.logical_or(
          ((x + d) % tile > b + 2 * d), ((y + d) % tile > b + 2 * d)
      )
      return m
  
file_path: DALI/dali/test/python/operator_1/test_gridmask.py
imports: from nvidia.dali.pipeline import Pipeline
  import nvidia.dali.fn
  import nvidia.dali.types
  import numpy
  import math
  import os
  import cv2
  import itertools
  from nose2.tools import params
  from test_utils import get_dali_extra_path
label_desc: Use image node_id 3 for calling a global function with example usage: get_mask(w, h, tile, ratio, angle, d) and returns: m