code: def keypoints_to_grid(
      keypoints: Tensor, img_size: Tuple[int, int]
  ) -> Tensor:
      """Convert a list of keypoints into a grid in [-1, 1]² that can be used in torch.nn.functional.interpolate.
  
      Args:
          keypoints: a tensor [N, 2] of N keypoints (ij coordinates convention).
          img_size: the original image size (H, W)
      """
      KORNIA_CHECK_SHAPE(keypoints, ["N", "2"])
      n_points = len(keypoints)
      grid_points = normalize_pixel_coordinates(
          keypoints[:, [1, 0]], img_size[0], img_size[1]
      )
      grid_points = grid_points.view(-1, n_points, 1, 2)
      return grid_points
  
imports: from typing import Any, Dict, Optional, Tuple
  import torch
  import torch.nn.functional
  from kornia.core import Module, Tensor, concatenate, pad, stack
  from kornia.core.check import KORNIA_CHECK_SHAPE
  from kornia.geometry.conversions import normalize_pixel_coordinates
  from kornia.utils import map_location_to_cpu
  from .backbones import SOLD2Net
  from .sold2_detector import LineSegmentDetectionModule, line_map_to_segments, prob_to_junctions
label_desc: Use image node_id 1 for calling a global function with example usage: keypoints_to_grid(keypoints, img_size) and returns: grid_points