class_docstr: Creates a [seq_length x seq_length] matrix for rel. pos encoding.
  
  Denoted as Phi in [2] and [3]. Phi is the standard sinusoid encoding
  matrix.
  
  Args:
      seq_length: The max. sequence length (time axis).
      out_dim: The number of nodes to go into the first Tranformer
          layer with.
  
  Returns:
      torch.Tensor: The encoding matrix Phi.
class_docstr_tok: ["Creates","a","[","seq_length","x","seq_length","]","matrix","for","rel",".","pos","encoding",".","Denoted","as","Phi","in","[","2","]","and","[","3","]",".","Phi","is","the","standard","sinusoid","encoding","matrix",".","Args",":","seq_length",":","The","max",".","sequence","length","(","time","axis",")",".","out_dim",":","The","number","of","nodes","to","go","into","the","first","Tranformer","layer","with",".","Returns",":","torch.Tensor",":","The","encoding","matrix","Phi","."]
code: def __init__(self, out_dim, **kwargs):
      super().__init__()
      self.out_dim = out_dim
  
      out_range = torch.arange(0, self.out_dim, 2.0)
      inverse_freq = 1 / (10000 ** (out_range / self.out_dim))
      self.register_buffer("inverse_freq", inverse_freq)
  
file_path: ray/rllib/models/torch/modules/relative_multi_head_attention.py
imports: from typing import Union
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.models.torch.misc import SlimFC
  from ray.rllib.utils.torch_utils import sequence_mask
  from ray.rllib.utils.typing import TensorType
label_desc: Use image node_id 1 to create a new RelativePositionEmbedding object from inherited base classes: nn with example: obj = RelativePositionEmbedding(out_dim)