class_docstr: Implements the frequency-based positional encoding described
  in [Attention is All you Need][0].
  
  Adds sinusoids of different frequencies to a `Tensor`. A sinusoid of a
  different frequency and phase is added to each dimension of the input `Tensor`.
  This allows the attention heads to use absolute and relative positions.
  
  The number of timescales is equal to hidden_dim / 2 within the range
  (min_timescale, max_timescale). For each timescale, the two sinusoidal
  signals sin(timestep / timescale) and cos(timestep / timescale) are
  generated and concatenated along the hidden_dim dimension.
  
  [0]: https://www.semanticscholar.org/paper/Attention-Is-All-You-Need-Vaswani-Shazeer/0737da0767d77606169cbf4187b83e1ab62f6077
  
  # Parameters
  
  tensor : `torch.Tensor`
      a Tensor with shape (batch_size, timesteps, hidden_dim).
  min_timescale : `float`, optional (default = `1.0`)
      The smallest timescale to use.
  max_timescale : `float`, optional (default = `1.0e4`)
      The largest timescale to use.
  
  # Returns
  
  `torch.Tensor`
      The input tensor augmented with the sinusoidal frequencies.
code: def __init__(
      self, min_timescale: float = 1.0, max_timescale: float = 1.0e4
  ):
      super().__init__()
      self.min_timescale = min_timescale
      self.max_timescale = max_timescale
  
file_path: allennlp/allennlp/modules/transformer/positional_encoding.py
imports: import math
  import torch
  from allennlp.common import FromParams
  from allennlp.nn.util import get_range_vector, get_device_of
label_desc: Use image node_id 1 to create a new SinusoidalPositionalEncoding object from inherited base classes: torch.nn, FromParams with example: obj = SinusoidalPositionalEncoding(min_timescale, max_timescale)