code: def grid_pos(
      height: int,
      width: int,
      dtype: Optional[torch.dtype] = None,
      device: Optional[torch.device] = None,
  ) -> Tensor:
      dtype = torch.float if dtype is None else dtype
      x = torch.arange(width, dtype=dtype, device=device)
      y = (height - 1) - torch.arange(
          height, dtype=dtype, device=device
      )
  
      x = x.repeat(height)
      y = y.unsqueeze(-1).repeat(1, width).view(-1)
  
      return torch.stack([x, y], dim=-1)
  
imports: from typing import Optional, Tuple
  import torch
  from torch import Tensor
  from torch_geometric.utils import coalesce
label_desc: Use image node_id 3 for calling a global function with example usage: grid_pos(height, width, dtype, device) and returns: torch