code: def _create_pairwise_bilateral_2d(sx, sy, sr, sg, sb, img):
      
      feat_size = 5
      feats = np.zeros((feat_size, img.shape[0], img.shape[1]), dtype=np.float32)
      for i in range(img.shape[0]):
          for j in range(img.shape[1]):
              feats[0, i, j] = i / sx
              feats[1, i, j] = j / sy
              feats[2, i, j] = img[i, j, 0] / sr
              feats[3, i, j] = img[i, j, 1] / sg
              feats[4, i, j] = img[i, j, 2] / sb
      return feats.reshape([feat_size, -1])
docs: A simple reference implementation for the 2D case. The ND implementation
      is faster.