class_docstr: Poly-encoder Agent that ingests image features.
  
  Agent that allows encoding image features and adding or concatenating them to the
  context encoding.
class_docstr_tok: ["Poly-encoder","Agent","that","ingests","image","features",".","Agent","that","allows","encoding","image","features","and","adding","or","concatenating","them","to","the","context","encoding","."]
docstr: Return the size of the batch.
  
  Use the size of the text vec if it exists; otherwise, use the length of the
  image feature list.
docstr_tok: ["Return","the","size","of","the","batch",".","Use","the","size","of","the","text","vec","if","it","exists",";","otherwise",",","use","the","length","of","the","image","feature","list","."]
code: def _get_batch_size(self, batch) -> int:
      """
      Return the size of the batch.
  
      Use the size of the text vec if it exists; otherwise, use the length of the
      image feature list.
      """
      if batch.text_vec is not None:
          return batch.text_vec.size(0)
      else:
          return len(batch.image)
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from typing import Any, Dict
  import torch
  from parlai.agents.image_seq2seq.modules import ContextWithImageEncoder
  from parlai.agents.transformer.polyencoder import PolyencoderAgent, PolyEncoderModule
  from parlai.core.torch_agent import Batch
  from parlai.core.torch_image_agent import TorchImageAgent
  from parlai.utils.misc import warn_once
label_desc: Use image node_id 4 for calling the ImagePolyencoderAgent obj's underlying member method code with example usage: obj._get_batch_size(batch) and returns: batch, len