class_docstr: NMT re-ranking.
  
  Args:
     alpha (float): Length parameter.
     beta (float):  Coverage parameter.
     length_penalty (str): Length penalty strategy.
     coverage_penalty (str): Coverage penalty strategy.
  
  Attributes:
      alpha (float): See above.
      beta (float): See above.
      length_penalty (callable): See :class:`penalties.PenaltyBuilder`.
      coverage_penalty (callable): See :class:`penalties.PenaltyBuilder`.
      has_cov_pen (bool): See :class:`penalties.PenaltyBuilder`.
      has_len_pen (bool): See :class:`penalties.PenaltyBuilder`.
class_docstr_tok: ["NMT","re-ranking",".","Args",":","alpha","(","float",")",":","Length","parameter",".","beta","(","float",")",":","Coverage","parameter",".","length_penalty","(","str",")",":","Length","penalty","strategy",".","coverage_penalty","(","str",")",":","Coverage","penalty","strategy",".","Attributes",":","alpha","(","float",")",":","See","above",".","beta","(","float",")",":","See","above",".","length_penalty","(","callable",")",":","See",":","class",":","`","penalties.PenaltyBuilder","`",".","coverage_penalty","(","callable",")",":","See",":","class",":","`","penalties.PenaltyBuilder","`",".","has_cov_pen","(","bool",")",":","See",":","class",":","`","penalties.PenaltyBuilder","`",".","has_len_pen","(","bool",")",":","See",":","class",":","`","penalties.PenaltyBuilder","`","."]
code: def __init__(self, alpha, beta, length_penalty, coverage_penalty):
      self._validate(alpha, beta, length_penalty, coverage_penalty)
      self.alpha = alpha
      self.beta = beta
      penalty_builder = penalties.PenaltyBuilder(
          coverage_penalty, length_penalty
      )
      self.has_cov_pen = penalty_builder.has_cov_pen
      # Term will be subtracted from probability
      self.cov_penalty = penalty_builder.coverage_penalty
  
      self.has_len_pen = penalty_builder.has_len_pen
      # Probability will be divided by this
      self.length_penalty = penalty_builder.length_penalty
  
imports: import torch
  from onmt.translate import penalties
  from onmt.translate.decode_strategy import DecodeStrategy
  import warnings
label_desc: Use image node_id 2 to create a new GNMTGlobalScorer object from inherited base classes: object with example: obj = GNMTGlobalScorer(alpha, beta, length_penalty, coverage_penalty)