class_docstr: This layer adds learnable positional embeddings to a 3D input tensor.
  
  Args:
      embed_dim (int): dimension of the input tensor
      num_embeddings (int): number of input embeddings. This is similar to vocab size in NLP.
      dropout (Optional[float]): Dropout rate. Default: 0.0
      channels_last (Optional[bool]): Channels dimension is the last in the input tensor
  
  Shape:
      - Input: :math:`(N, *, C, P)` or :math:`(N, *, P, C)` where :math:`N` is the batch size, :math:`C` is the embedding dimension,
          :math:`P` is the number of patches
      - Output: same shape as the input
class_docstr_tok: ["This","layer","adds","learnable","positional","embeddings","to","a","3D","input","tensor",".","Args",":","embed_dim","(","int",")",":","dimension","of","the","input","tensor","num_embeddings","(","int",")",":","number","of","input","embeddings",".","This","is","similar","to","vocab","size","in","NLP",".","dropout","(","Optional","[","float","]",")",":","Dropout","rate",".","Default",":","0.0","channels_last","(","Optional","[","bool","]",")",":","Channels","dimension","is","the","last","in","the","input","tensor","Shape",":","-","Input",":",":","math",":","`","(","N",",","*",",","C",",","P",")","`","or",":","math",":","`","(","N",",","*",",","P",",","C",")","`","where",":","math",":","`","N","`","is","the","batch","size",",",":","math",":","`","C","`","is","the","embedding","dimension",",",":","math",":","`","P","`","is","the","number","of","patches","-","Output",":","same","shape","as","the","input"]
code: def __init__(
      self,
      embed_dim: int,
      num_embeddings: int,
      dropout: Optional[float] = 0.0,
      channels_last: Optional[bool] = True,
      *args,
      **kwargs,
  ) -> None:
      super().__init__()
      self.pos_emb = nn.Embedding(
          num_embeddings=num_embeddings, embedding_dim=embed_dim
      )
      self.channel_last = channels_last
      self.dropout = Dropout(p=dropout)
  
file_path: ml-cvnets/cvnets/layers/positional_encoding.py
imports: import math
  from typing import Optional
  import torch
  from torch import Tensor, nn
  from cvnets.layers.base_layer import BaseLayer
  from cvnets.layers.dropout import Dropout
label_desc: Use image node_id 1 to create a new LearnablePositionEncoding object from inherited base classes: BaseLayer with example: obj = LearnablePositionEncoding(embed_dim, num_embeddings, dropout, channels_last)