code: def __init__(
      self,
      opts,
      num_embeddings: int,
      embedding_dim: int,
      padding_idx: Optional[int] = None,
      is_learnable: Optional[bool] = False,
      sequence_first: Optional[bool] = False,
      interpolation_mode: Optional[str] = "bilinear",
      *args,
      **kwargs,
  ):
      super().__init__(*args, **kwargs)
      module = (
          LearnablePositionalEmbedding
          if is_learnable
          else SinusoidalPositionalEmbedding
      )
      self.pos_embed = module(
          opts,
          num_embeddings=num_embeddings,
          embedding_dim=embedding_dim,
          padding_idx=padding_idx,
          sequence_first=sequence_first,
          interpolation_mode=interpolation_mode,
          *args,
          **kwargs,
      )
  
imports: import math
  from typing import Optional
  import torch
  from torch import Tensor, nn
  from torch.nn import functional
  from cvnets.layers import BaseLayer
label_desc: Use image node_id 1 to create a new PositionalEmbedding object from inherited base classes: BaseLayer with example: obj = PositionalEmbedding(opts, num_embeddings, embedding_dim, padding_idx, is_learnable, sequence_first, interpolation_mode)