class_docstr: A Pytorch module to obtain feature embeddings for pairwise features
  
  Usage:
      encoder = PairwiseEncoder(config)
      pairwise_features = encoder(pair_indices, doc)
code: def forward(
      self,  # type: ignore  # pylint: disable=arguments-differ  #35566 in pytorch
      top_indices: torch.Tensor,
      doc: Doc,
  ) -> torch.Tensor:
      word_ids = torch.arange(
          0, len(doc["cased_words"]), device=self.device
      )
      speaker_map = torch.tensor(
          self._speaker_map(doc), device=self.device
      )
  
      same_speaker = speaker_map[top_indices] == speaker_map.unsqueeze(
          1
      )
      same_speaker = self.speaker_emb(same_speaker.to(torch.long))
  
      # bucketing the distance (see __init__())
      distance = (
          word_ids.unsqueeze(1) - word_ids[top_indices]
      ).clamp_min_(min=1)
      log_distance = distance.to(torch.float).log2().floor_()
      log_distance = log_distance.clamp_max_(max=6).to(torch.long)
      distance = torch.where(
          distance < 5, distance - 1, log_distance + 2
      )
      distance = self.distance_emb(distance)
  
      genre = torch.tensor(
          self.genre2int[doc["document_id"][:2]], device=self.device
      ).expand_as(top_indices)
      genre = self.genre_emb(genre)
  
      return self.dropout(
          torch.cat((same_speaker, distance, genre), dim=2)
      )
  
file_path: stanza/stanza/models/coref/pairwise_encoder.py
imports: from typing import List
  import torch
  from stanza.models.coref.config import Config
  from stanza.models.coref.const import Doc
label_desc: Use image node_id 3 for calling the PairwiseEncoder obj's underlying member method code with example usage: obj.forward(top_indices, doc) and returns: self