code: def get_2d_sincos_pos_embed(embed_dim, grid_size, cls_token=False):
      """
      grid_size: int of the grid height and width
      return:
      pos_embed: [grid_size*grid_size, embed_dim] or [1+grid_size*grid_size, embed_dim] (w/ or w/o cls_token)
      """
      grid_h = np.arange(grid_size, dtype=np.float32)
      grid_w = np.arange(grid_size, dtype=np.float32)
      grid = np.meshgrid(grid_w, grid_h)  # here w goes first
      grid = np.stack(grid, axis=0)
  
      grid = grid.reshape([2, 1, grid_size, grid_size])
      pos_embed = get_2d_sincos_pos_embed_from_grid(embed_dim, grid)
      if cls_token:
          pos_embed = np.concatenate(
              [np.zeros([1, embed_dim]), pos_embed], axis=0
          )
      return pos_embed
  
file_path: SlowFast/slowfast/models/utils.py
imports: import numpy
  import torch
  import slowfast.utils.logging
label_desc: Use image node_id 5 for calling a global function with example usage: get_2d_sincos_pos_embed(embed_dim, grid_size, cls_token) and returns: pos_embed