class_docstr: Poly-encoder Agent.
  
  Equivalent of bert_ranker/polyencoder and biencoder_multiple_output but does not
  rely on an external library (hugging face).
class_docstr_tok: ["Poly-encoder","Agent",".","Equivalent","of","bert_ranker\/polyencoder","and","biencoder_multiple_output","but","does","not","rely","on","an","external","library","(","hugging","face",")","."]
docstr: Score candidates.
  
  The Poly-encoder encodes the candidate and context independently. Then, the
  model applies additional attention before ultimately scoring a candidate.
docstr_tok: ["Score","candidates",".","The","Poly-encoder","encodes","the","candidate","and","context","independently",".","Then",",","the","model","applies","additional","attention","before","ultimately","scoring","a","candidate","."]
code: def score_candidates(self, batch, cand_vecs, cand_encs=None):
      """
      Score candidates.
  
      The Poly-encoder encodes the candidate and context independently. Then, the
      model applies additional attention before ultimately scoring a candidate.
      """
      ctxt_rep, ctxt_rep_mask = self.get_ctxt_rep(batch)
      cand_rep = self.get_cand_rep(batch, cand_vecs, cand_encs)
      scores = self.get_scores(ctxt_rep, ctxt_rep_mask, cand_rep)
      return scores
  
imports: from parlai.core.params import ParlaiParser
  from typing import Any, Dict, Optional, Tuple
  import torch
  from parlai.core.opt import Opt
  from parlai.core.torch_ranker_agent import TorchRankerAgent
  from parlai.core.torch_agent import Batch
  from parlai.utils.misc import recursive_getattr
  from parlai.utils.logging import logging
  from .biencoder import AddLabelFixedCandsTRA
  from .modules import BasicAttention, MultiHeadAttention, TransformerEncoder
  from .transformer import TransformerRankerAgent
label_desc: Use image node_id 13 for calling the PolyencoderAgent obj's underlying member method code with example usage: obj.score_candidates(batch, cand_vecs, cand_encs) and returns: scores