code: def get_relative_position_index(
      win_h: int, win_w: int
  ) -> torch.Tensor:
      """Function to generate pair-wise relative position index for each token inside the window.
          Taken from Timms Swin V1 implementation.
      Args:
          win_h (int): Window/Grid height.
          win_w (int): Window/Grid width.
      Returns:
          relative_coords (torch.Tensor): Pair-wise relative position indexes [height * width, height * width].
      """
      coords = torch.stack(
          torch.meshgrid([torch.arange(win_h), torch.arange(win_w)])
      )
      coords_flatten = torch.flatten(coords, 1)
      relative_coords = (
          coords_flatten[:, :, None] - coords_flatten[:, None, :]
      )
      relative_coords = relative_coords.permute(1, 2, 0).contiguous()
      relative_coords[:, :, 0] += win_h - 1
      relative_coords[:, :, 1] += win_w - 1
      relative_coords[:, :, 0] *= 2 * win_w - 1
      return relative_coords.sum(-1)
  
label_desc: Use image node_id 1 for calling a global function with example usage: get_relative_position_index(win_h, win_w) and returns: relative_coords