class_docstr: Fixed positional encoding with sine and cosine functions.
docstr: Args:
      x (Tensor): Tensor of shape (batch_size, pos_len, d_hid, ...)
docstr_tok: ["Args",":","x","(","Tensor",")",":","Tensor","of","shape","(","batch_size",",","pos_len",",","d_hid",",","...",")"]
code: def forward(self, x):
      """
      Args:
          x (Tensor): Tensor of shape (batch_size, pos_len, d_hid, ...)
      """
      self.device = x.device
      x = x + self.position_table[:, : x.size(1)].clone().detach()
      return self.dropout(x)
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmocr.registry import MODELS
label_desc: Use image node_id 3 for calling the PositionalEncoding obj's underlying member method code with example usage: obj.forward(x) and returns: self