class_docstr: ALiBi (Attention with Linear Biases) relative position embedding for auto-regressive decoder
  and joint encoder (symmetric for forward and backward distance).
  Based on https://arxiv.org/bas/2108.12409
code: def forward(self, query_seq_length, key_seq_length):
      # used cached relative position if possible
      max_seq_len = max(query_seq_length, key_seq_length)
      if max_seq_len > self.max_seq_len:
          relative_position = (
              build_relative_position(
                  max_seq_len, full=self.bidirectional
              )
              .unsqueeze(0)
              .expand(self.num_attention_heads, -1, -1)
          )
      else:
          relative_position = self.relative_position
      # shape (num_attention_heads, query_seq_length, key_seq_length)
      relative_position = relative_position[
          :, -query_seq_length:, -key_seq_length:
      ]
      # if not bidirectional, mask out the future positions
  
      # shape (1, num_heads, query_length, key_length)
      return -relative_position.unsqueeze(0) * self.slopes
  
file_path: NeMo/nemo/collections/nlp/modules/common/megatron/position_embedding/alibi_relative_position_embedding.py
imports: import math
  import torch
label_desc: Use image node_id 2 for calling the ALiBiRelativePositionEmbedding obj's underlying member method code with example usage: obj.forward(query_seq_length, key_seq_length) and returns: unknown