class_docstr: Translate a batch of sentences with a saved model.
  
  Args:
      model (onmt.modules.NMTModel): NMT model to use for translation
      vocabs (dict[str, Vocab]): A dict
          mapping each side's Vocab.
      gpu (int): GPU device. Set to negative for no GPU.
      n_best (int): How many beams to wait for.
      min_length (int): See
          :class:`onmt.translate.decode_strategy.DecodeStrategy`.
      max_length (int): See
          :class:`onmt.translate.decode_strategy.DecodeStrategy`.
      beam_size (int): Number of beams.
      random_sampling_topk (int): See
          :class:`onmt.translate.greedy_search.GreedySearch`.
      random_sampling_temp (float): See
          :class:`onmt.translate.greedy_search.GreedySearch`.
      stepwise_penalty (bool): Whether coverage penalty is applied every step
          or not.
      dump_beam (bool): Debugging option.
      block_ngram_repeat (int): See
          :class:`onmt.translate.decode_strategy.DecodeStrategy`.
      ignore_when_blocking (set or frozenset): See
          :class:`onmt.translate.decode_strategy.DecodeStrategy`.
      replace_unk (bool): Replace unknown token.
      tgt_file_prefix (bool): Force the predictions begin with provided -tgt.
      data_type (str): Source data type.
      verbose (bool): Print/log every translation.
      report_time (bool): Print/log total time/frequency.
      copy_attn (bool): Use copy attention.
      global_scorer (onmt.translate.GNMTGlobalScorer): Translation
          scoring/reranking object.
      out_file (TextIO or codecs.StreamReaderWriter): Output file.
      report_score (bool) : Whether to report scores
      logger (logging.Logger or NoneType): Logger.
class_docstr_tok: ["Translate","a","batch","of","sentences","with","a","saved","model",".","Args",":","model","(","onmt.modules.NMTModel",")",":","NMT","model","to","use","for","translation","vocabs","(","dict","[","str",",","Vocab","]",")",":","A","dict","mapping","each","side","'s","Vocab",".","gpu","(","int",")",":","GPU","device",".","Set","to","negative","for","no","GPU",".","n_best","(","int",")",":","How","many","beams","to","wait","for",".","min_length","(","int",")",":","See",":","class",":","`","onmt.translate.decode_strategy.DecodeStrategy","`",".","max_length","(","int",")",":","See",":","class",":","`","onmt.translate.decode_strategy.DecodeStrategy","`",".","beam_size","(","int",")",":","Number","of","beams",".","random_sampling_topk","(","int",")",":","See",":","class",":","`","onmt.translate.greedy_search.GreedySearch","`",".","random_sampling_temp","(","float",")",":","See",":","class",":","`","onmt.translate.greedy_search.GreedySearch","`",".","stepwise_penalty","(","bool",")",":","Whether","coverage","penalty","is","applied","every","step","or","not",".","dump_beam","(","bool",")",":","Debugging","option",".","block_ngram_repeat","(","int",")",":","See",":","class",":","`","onmt.translate.decode_strategy.DecodeStrategy","`",".","ignore_when_blocking","(","set","or","frozenset",")",":","See",":","class",":","`","onmt.translate.decode_strategy.DecodeStrategy","`",".","replace_unk","(","bool",")",":","Replace","unknown","token",".","tgt_file_prefix","(","bool",")",":","Force","the","predictions","begin","with","provided","-tgt",".","data_type","(","str",")",":","Source","data","type",".","verbose","(","bool",")",":","Print\/log","every","translation",".","report_time","(","bool",")",":","Print\/log","total","time\/frequency",".","copy_attn","(","bool",")",":","Use","copy","attention",".","global_scorer","(","onmt.translate.GNMTGlobalScorer",")",":","Translation","scoring\/reranking","object",".","out_file","(","TextIO","or","codecs.StreamReaderWriter",")",":","Output","file",".","report_score","(","bool",")",":","Whether","to","report","scores","logger","(","logging.Logger","or","NoneType",")",":","Logger","."]
code: def _score_target(self, batch, enc_out, src_len, src_map):
      raise NotImplementedError
  
imports: import torch
  from torch.nn.functional import log_softmax
  from torch.nn.utils.rnn import pad_sequence
  import codecs
  from time import time
  from math import exp
  from itertools import count, zip_longest
  from copy import deepcopy
  import onmt.model_builder
  import onmt.decoders.ensemble
  from onmt.constants import DefaultTokens
  from onmt.translate.beam_search import BeamSearch, BeamSearchLM
  from onmt.translate.greedy_search import GreedySearch, GreedySearchLM
  from onmt.utils.misc import tile, set_random_seed, report_matrix
  from onmt.utils.alignment import extract_alignment, build_align_pharaoh
  from onmt.modules.copy_generator import collapse_copy_scores
  from onmt.constants import ModelTask
  from onmt.transforms import TransformPipe
label_desc: Use image node_id 11 for calling the Inference obj's underlying member method code with example usage: obj._score_target(batch, enc_out, src_len, src_map) without return types