class_docstr: Rescores source and target tokens based on a model
code: def prepare_inputs(self, src_tokens, hypos):
      beam_size = len(hypos) // len(src_tokens)
      bsz, src_length = src_tokens.size()
      src_tokens_expand = (
          src_tokens.unsqueeze(dim=1)
          .expand(-1, beam_size, -1)
          .contiguous()
          .view(bsz * beam_size, -1)
      )
      src_lengths = (
          torch.tensor(src_length)
          .repeat(bsz * beam_size)
          .type_as(src_tokens)
      )
      encoder_inputs = (src_tokens_expand, src_lengths)
      tgt_tokens = self.convert_hypos_to_tgt_tokens(hypos).type_as(
          src_tokens
      )
      return encoder_inputs, tgt_tokens
  
imports: import torch
  from pytorch_translate import utils
label_desc: Use image node_id 6 for calling the SimpleModelScorer obj's underlying member method code with example usage: obj.prepare_inputs(src_tokens, hypos) and returns: encoder_inputs,  tgt_tokens