code: def get_2d_sincos_pos_embed_from_grid(
      embed_dim: int, grid: np.ndarray
  ) -> torch.Tensor:
      """
      Get 2D sine-cosine positional embedding from grid.
      Args:
          embed_dim: embedding dimension.
          grid: positions
      Returns:
          (torch.Tensor): [grid_size*grid_size, embed_dim] or [1+grid_size*grid_size, embed_dim] (w/ or w/o cls_token)
  
      """
      assert embed_dim % 2 == 0
  
      emb_h = get_1d_sincos_pos_embed_from_grid(embed_dim // 2, grid[0])
      emb_w = get_1d_sincos_pos_embed_from_grid(embed_dim // 2, grid[1])
  
      emb = np.concatenate([emb_h, emb_w], axis=1)
      return emb
  
file_path: pytorchvideo/pytorchvideo/layers/positional_encoding.py
imports: import math
  from typing import Tuple
  import numpy
  import torch
  from torch import nn
label_desc: Use image node_id 3 for calling a global function with example usage: get_2d_sincos_pos_embed_from_grid(embed_dim, grid) and returns: emb