class_docstr: Receives bert contextual embeddings of a text, extracts all the
  possible mentions in that text. 
class_docstr_tok: ["Receives","bert","contextual","embeddings","of","a","text",",","extracts","all","the","possible","mentions","in","that","text","."]
docstr: Extracts word representations from text.
  
  Args:
      doc: the document data
      x: a tensor containing bert output, shape (n_subtokens, bert_dim)
  
  Returns:
      words: a Tensor of shape [n_words, mention_emb];
          mention representations
      cluster_ids: tensor of shape [n_words], containing cluster indices
          for each word. Non-coreferent words have cluster id of zero.
docstr_tok: ["Extracts","word","representations","from","text",".","Args",":","doc",":","the","document","data","x",":","a","tensor","containing","bert","output",",","shape","(","n_subtokens",",","bert_dim",")","Returns",":","words",":","a","Tensor","of","shape","[","n_words",",","mention_emb","]",";","mention","representations","cluster_ids",":","tensor","of","shape","[","n_words","]",",","containing","cluster","indices","for","each","word",".","Non-coreferent","words","have","cluster","id","of","zero","."]
code: def forward(
      self,  # type: ignore  # pylint: disable=arguments-differ  #35566 in pytorch
      doc: Doc,
      x: torch.Tensor,
  ) -> Tuple[torch.Tensor, ...]:
      """
      Extracts word representations from text.
  
      Args:
          doc: the document data
          x: a tensor containing bert output, shape (n_subtokens, bert_dim)
  
      Returns:
          words: a Tensor of shape [n_words, mention_emb];
              mention representations
          cluster_ids: tensor of shape [n_words], containing cluster indices
              for each word. Non-coreferent words have cluster id of zero.
      """
      word_boundaries = torch.tensor(
          doc["word2subword"], device=self.device
      )
      starts = word_boundaries[:, 0]
      ends = word_boundaries[:, 1]
  
      # [n_mentions, features]
      words = self._attn_scores(x, starts, ends).mm(x)
  
      words = self.dropout(words)
  
      return (words, self._cluster_ids(doc))
  
file_path: stanza/stanza/models/coref/word_encoder.py
imports: from typing import Tuple
  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 WordEncoder obj's underlying member method code with example usage: obj.forward(doc, x) and returns: words,  self