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: Add command-line arguments specifically for this agent.
docstr_tok: ["Add","command-line","arguments","specifically","for","this","agent","."]
code: def add_cmdline_args(
      cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None
  ) -> ParlaiParser:
      """
      Add command-line arguments specifically for this agent.
      """
      TransformerRankerAgent.add_cmdline_args(
          parser, partial_opt=partial_opt
      )
      agent = parser.add_argument_group("Polyencoder Arguments")
      agent.add_argument(
          "--polyencoder-type",
          type=str,
          default="codes",
          choices=["codes", "n_first"],
          help="Type of polyencoder, either we compute"
          "vectors using codes + attention, or we "
          "simply take the first N vectors.",
          recommended="codes",
      )
      agent.add_argument(
          "--poly-n-codes",
          type=int,
          default=64,
          help="number of vectors used to represent the context"
          "in the case of n_first, those are the number"
          "of vectors that are considered.",
          recommended=64,
      )
      agent.add_argument(
          "--poly-attention-type",
          type=str,
          default="basic",
          choices=["basic", "sqrt", "multihead"],
          help="Type of the top aggregation layer of the poly-"
          "encoder (where the candidate representation is"
          "the key)",
          recommended="basic",
      )
      agent.add_argument(
          "--poly-attention-num-heads",
          type=int,
          default=4,
          help="In case poly-attention-type is multihead, "
          "specify the number of heads",
      )
  
      # Those arguments are here in case where polyencoder type is 'code'
      agent.add_argument(
          "--codes-attention-type",
          type=str,
          default="basic",
          choices=["basic", "sqrt", "multihead"],
          help="Type ",
          recommended="basic",
      )
      agent.add_argument(
          "--codes-attention-num-heads",
          type=int,
          default=4,
          help="In case codes-attention-type is multihead, "
          "specify the number of heads",
      )
      return agent
  
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 1 for calling the PolyencoderAgent obj's underlying member method code with example usage: obj.add_cmdline_args(cls, parser, partial_opt) and returns: agent