class_docstr: This class implements the absolute sinusoidal positional encoding function.
  PE(pos, 2i)   = sin(pos/(10000^(2i/dmodel)))
  PE(pos, 2i+1) = cos(pos/(10000^(2i/dmodel)))
  Arguments
  ---------
  input_size: int
      Embedding dimension.
  max_len : int, optional
      Max length of the input sequences (default 2500).
  Example
  -------
  >>> a = torch.rand((8, 120, 512))
  >>> enc = PositionalEncoding(input_size=a.shape[-1])
  >>> b = enc(a)
  >>> b.shape
  torch.Size([1, 120, 512])
code: def __init__(self, input_size, max_len=2500):
      super().__init__()
      if input_size % 2 != 0:
          raise ValueError(
              f"Cannot use sin/cos positional encoding with odd channels (got channels={input_size})"
          )
      self.max_len = max_len
      pe = torch.zeros(self.max_len, input_size, requires_grad=False)
      positions = torch.arange(0, self.max_len).unsqueeze(1).float()
      denominator = torch.exp(
          torch.arange(0, input_size, 2).float()
          * -(math.log(10000.0) / input_size)
      )
  
      pe[:, 0::2] = torch.sin(positions * denominator)
      pe[:, 1::2] = torch.cos(positions * denominator)
      pe = pe.unsqueeze(0)
      self.register_buffer("pe", pe)
  
imports: import math
  import torch
  import torch.nn
  import speechbrain
  from typing import Optional
  import numpy
  from .Conformer import ConformerEncoder
  from .Branchformer import BranchformerEncoder
  from speechbrain.nnet.activations import Swish
  from speechbrain.nnet.attention import RelPosEncXL
  from speechbrain.nnet.CNN import Conv1d
label_desc: Use image node_id 1 to create a new PositionalEncoding object from inherited base classes: nn with example: obj = PositionalEncoding(input_size, max_len)