code: def rgb_bayer_masks(img_shape, pattern):
      h, w = img_shape
      assert h % 2 == 0 and w % 2 == 0, f"h: {h}, w: {w}"
      assert 0 <= pattern <= 3
  
      def sensor_matrix_00_is_green(pattern):
          return pattern in (BayerPattern.GRBG, BayerPattern.GBRG)
  
      def red_is_in_the_first_row(pattern):
          return pattern in (BayerPattern.BGGR, BayerPattern.GBRG)
  
      def vec(n, mod=2):
          return np.arange(0, n, dtype=np.uint8) % mod
  
      if sensor_matrix_00_is_green(pattern):
          top_right_mask = np.outer(1 - vec(h), vec(w))
          bottom_left_mask = np.outer(vec(h), 1 - vec(w))
          green = 1 - top_right_mask - bottom_left_mask
          if red_is_in_the_first_row(pattern):
              return top_right_mask, green, bottom_left_mask
          return bottom_left_mask, green, top_right_mask
      else:
          top_left_mask = np.outer(1 - vec(h), 1 - vec(w))
          bottom_right_mask = np.outer(vec(h), vec(w))
          green = 1 - top_left_mask - bottom_right_mask
          if red_is_in_the_first_row(pattern):
              return top_left_mask, green, bottom_right_mask
          return bottom_right_mask, green, top_left_mask
  
file_path: DALI/dali/test/python/debayer_test_utils.py
imports: import numpy
  from scipy.signal import convolve2d
label_desc: Use image node_id 3 for calling a global function with example usage: rgb_bayer_masks(img_shape, pattern) and returns: unknown, unknown, unknown, bottom_left_mask,  green,  top_right_mask, bottom_right_mask,  green,  top_left_mask, top_right_mask,  green,  bottom_left_mask, top_left_mask,  green,  bottom_right_mask