code: def generate_regular_grid_point_coords(R, side_size, device):
      """
      Generate regular square grid of points in [0, 1] x [0, 1] coordinate space.
  
      Args:
          R (int): The number of grids to sample, one for each region.
          side_size (int): The side size of the regular grid.
          device (torch.device): Desired device of returned tensor.
  
      Returns:
          (Tensor): A tensor of shape (R, side_size^2, 2) that contains coordinates
              for the regular grids.
      """
      aff = torch.tensor(
          [[[0.5, 0, 0.5], [0, 0.5, 0.5]]], device=device
      )
      r = F.affine_grid(
          aff,
          torch.Size((1, 1, side_size, side_size)),
          align_corners=False,
      )
      return r.view(1, -1, 2).expand(R, -1, -1)
  
file_path: detectron2/projects/PointRend/point_rend/point_features.py
imports: import torch
  from torch.nn import functional
  from detectron2.layers import cat, shapes_to_tensor
  from detectron2.structures import BitMasks, Boxes
label_desc: Use image node_id 2 for calling a global function with example usage: generate_regular_grid_point_coords(R, side_size, device) and returns: r