class_docstr: Implements the positional encoding as described in the NIPS2017 paper
  'Attention Is All You Need' about Transformers
  (https://arxiv.org/abs/1706.03762).
  Essentially, for all timesteps in a given sequence,
  adds information about the relative temporal location of a timestep
  directly into the features of that timestep, and then returns this
  slightly-modified, same-shape sequence.
  
  args:
      d_model: the number of features that each timestep has (required).
      max_len: the maximum sequence length that the positional
                encodings should support (required).
code: def __init__(self, d_model: int, max_len: int = 5000):
      super(PositionalEncoding, self).__init__()
  
      pe = torch.zeros(max_len, d_model)
      position = torch.arange(0, max_len, dtype=torch.float).unsqueeze(
          1
      )
  
      div_term = torch.exp(
          torch.arange(0, d_model, 2).float()
          * (-math.log(10000.0) / d_model)
      )
      pe[:, 0::2] = torch.sin(position * div_term)
      pe[:, 1::2] = torch.cos(position * div_term)
  
      pe = pe.unsqueeze(0).transpose(0, 1)
      self.register_buffer("pe", pe)
  
      self.scaling_term = math.sqrt(d_model)
      self.max_len = max_len
      self.d_model = d_model
  
imports: import math
  import torch
  import torch.nn
label_desc: Use image node_id 1 to create a new PositionalEncoding object from inherited base classes: nn with example: obj = PositionalEncoding(d_model, max_len)