class_docstr: Rescores source and target tokens based on a model
docstr: hypos is a list of hypotheses containing elements of type dict.
  each hypothesis dictionary contains target tokens.
  we convert these target tokens to a tensor, also eos token to the
  left and right, and padding to the end.
docstr_tok: ["hypos","is","a","list","of","hypotheses","containing","elements","of","type","dict",".","each","hypothesis","dictionary","contains","target","tokens",".","we","convert","these","target","tokens","to","a","tensor",",","also","eos","token","to","the","left","and","right",",","and","padding","to","the","end","."]
code: def convert_hypos_to_tgt_tokens(self, hypos):
      """
      hypos is a list of hypotheses containing elements of type dict.
      each hypothesis dictionary contains target tokens.
      we convert these target tokens to a tensor, also eos token to the
      left and right, and padding to the end.
      """
      max_tgt_len = max(len(hypo["tokens"]) for hypo in hypos)
      pad = self.task.target_dictionary.pad()
      tgt_tokens = torch.full(
          (len(hypos), max_tgt_len + 1),
          fill_value=pad,
          dtype=torch.long,
      )
      eos = self.task.target_dictionary.eos()
      tgt_tokens[:, 0] = torch.tensor(eos)
  
      for i, hypo in enumerate(hypos):
          start = 1
          end = start + len(hypo["tokens"])
          tgt_tokens[i, start:end] = hypo["tokens"]
  
      return tgt_tokens
  
imports: import torch
  from pytorch_translate import utils
label_desc: Use image node_id 2 for calling the SimpleModelScorer obj's underlying member method code with example usage: obj.convert_hypos_to_tgt_tokens(hypos) and returns: tgt_tokens