code: def grid_sample(
      img: Tensor,
      absolute_grid: Tensor,
      mode: str = "bilinear",
      align_corners: Optional[bool] = None,
  ):
      """Same as torch's grid_sample, with absolute pixel coordinates instead of normalized coordinates."""
      h, w = img.shape[-2:]
  
      xgrid, ygrid = absolute_grid.split([1, 1], dim=-1)
      xgrid = 2 * xgrid / (w - 1) - 1
      # Adding condition if h > 1 to enable this function be reused in raft-stereo
      if h > 1:
          ygrid = 2 * ygrid / (h - 1) - 1
      normalized_grid = torch.cat([xgrid, ygrid], dim=-1)
  
      return F.grid_sample(
          img, normalized_grid, mode=mode, align_corners=align_corners
      )
  
imports: from typing import Optional
  import torch
  import torch.nn.functional
  from torch import Tensor
label_desc: Use image node_id 1 for calling a global function with example usage: grid_sample(img, absolute_grid, mode, align_corners) and returns: F