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).
docstr: Expects input of shape (sequence_length, batch_size, num_features)
  and returns output of the same shape. sequence_length is at most
  allowed to be self.max_len and num_features is expected to
  be exactly self.d_model
  
  Args:
      x: a sequence input of shape (sequence_length, batch_size, num_features) (required).
docstr_tok: ["Expects","input","of","shape","(","sequence_length",",","batch_size",",","num_features",")","and","returns","output","of","the","same","shape",".","sequence_length","is","at","most","allowed","to","be","self.max_len","and","num_features","is","expected","to","be","exactly","self.d_model","Args",":","x",":","a","sequence","input","of","shape","(","sequence_length",",","batch_size",",","num_features",")","(","required",")","."]
code: def forward(self, x):
      """
      Expects input of shape (sequence_length, batch_size, num_features)
      and returns output of the same shape. sequence_length is at most
      allowed to be self.max_len and num_features is expected to
      be exactly self.d_model
  
      Args:
          x: a sequence input of shape (sequence_length, batch_size, num_features) (required).
      """
      x = (
          x * self.scaling_term
      )  # make embedding relatively larger than positional encoding
      x = x + self.pe[: x.size(0), :]
      return x
  
imports: import math
  import torch
  import torch.nn
label_desc: Use image node_id 2 for calling the PositionalEncoding obj's underlying member method code with example usage: obj.forward(x) and returns: x