code: def get_1d_sincos_pos_embed_from_grid(
      embed_dim: int, pos: NDArray[np.int_]
  ) -> NDArray[np.float_]:
      """Returns 1D sin-cos embeddings grid. Code from [0].
  
      - [0]: https://github.com/facebookresearch/ijepa
  
      Args:
          embed_dim:
              Embedding dimension.
          pos:
              1-dimensional grid to embed.
  
      Returns:
          Positional embeddings array with size (grid_size, embed_dim).
      """
      assert embed_dim % 2 == 0
      omega = np.arange(embed_dim // 2, dtype=float)
      omega /= embed_dim / 2.0
      omega = 1.0 / 10000**omega  # (D/2,)
  
      pos = pos.reshape(-1)  # (M,)
      out = np.einsum("m,d->md", pos, omega)  # (M, D/2), outer product
  
      emb_sin = np.sin(out)  # (M, D/2)
      emb_cos = np.cos(out)  # (M, D/2)
  
      emb = np.concatenate([emb_sin, emb_cos], axis=1)  # (M, D)
      return emb
  
imports: import math
  import warnings
  from typing import Iterable, List, Optional, Tuple, Union
  import numpy
  import torch
  import torch.distributed
  import torch.nn
  from numpy.typing import NDArray
  from torch.nn import Module
  from torch.nn.modules.batchnorm import _BatchNorm
  from torch.nn.parameter import Parameter
label_desc: Use image node_id 27 for calling a global function with example usage: get_1d_sincos_pos_embed_from_grid(embed_dim, pos) and returns: emb