class_docstr: Relative positional encoding.
  
  Args:
      size: Module size.
      max_len: Maximum input length.
      dropout_rate: Dropout rate.
docstr: Compute positional encoding.
  
  Args:
      x: Input sequences. (B, T, ?)
      left_context: Number of previous frames the attention module can see
                    in current chunk.
  
  Returns:
      pos_enc: Positional embedding sequences. (B, 2 * (T - 1), ?)
docstr_tok: ["Compute","positional","encoding",".","Args",":","x",":","Input","sequences",".","(","B",",","T",",","?",")","left_context",":","Number","of","previous","frames","the","attention","module","can","see","in","current","chunk",".","Returns",":","pos_enc",":","Positional","embedding","sequences",".","(","B",",","2","*","(","T","-","1",")",",","?",")"]
code: def forward(
      self, x: torch.Tensor, left_context: int = 0
  ) -> torch.Tensor:
      """Compute positional encoding.
  
      Args:
          x: Input sequences. (B, T, ?)
          left_context: Number of previous frames the attention module can see
                        in current chunk.
  
      Returns:
          pos_enc: Positional embedding sequences. (B, 2 * (T - 1), ?)
  
      """
      self.extend_pe(x, left_context=left_context)
  
      time1 = x.size(1) + left_context
  
      pos_enc = self.pe[
          :,
          self.pe.size(1) // 2
          - time1
          + 1 : self.pe.size(1) // 2
          + x.size(1),
      ]
      pos_enc = self.dropout(pos_enc)
  
      return pos_enc
  
imports: import math
  import torch
  from espnet.nets.pytorch_backend.transformer.embedding import _pre_hook
label_desc: Use image node_id 3 for calling the RelPositionalEncoding obj's underlying member method code with example usage: obj.forward(x, left_context) and returns: pos_enc