class_docstr: Score function used in beam search.
  
  Implements the length-penalized score function first used in the GNMT paper::
  
      scores = (log_probs + scores) / length_penalty
      length_penalty = (\frac{K + length}{K + 1})^\alpha
  
  See Also
  
  "Google's Neural Machine Translation System: Bridging the Gap between Human and
  Machine Translation (https://arxiv.org/pdf/1609.08144.pdf)"
  
  Parameters
  ----------
  alpha
      If `alphas < 1.0`, it favors shorter sequences
      If `alpha >= 1.0`, it favors longer sequences
  K
      Parameter in the formula
  from_logits
      Whether input is a log probability (usually from log_softmax) instead
      of unnormalized numbers.
  temperature
      The temperature of the scoring function
class_docstr_tok: ["Score","function","used","in","beam","search",".","Implements","the","length-penalized","score","function","first","used","in","the","GNMT","paper",":",":","scores","=","(","log_probs","+","scores",")","\/","length_penalty","length_penalty","=","(","\\frac","{","K","+","length","}","{","K","+","1","}",")","^\\alpha","See","Also","''","Google","'s","Neural","Machine","Translation","System",":","Bridging","the","Gap","between","Human","and","Machine","Translation","(","https",":","\/\/arxiv.org\/pdf\/1609.08144.pdf",")","''","Parameters","--","--","--","--","--","alpha","If","`","alphas","<","1.0","`",",","it","favors","shorter","sequences","If","`","alpha",">","=","1.0","`",",","it","favors","longer","sequences","K","Parameter","in","the","formula","from_logits","Whether","input","is","a","log","probability","(","usually","from","log_softmax",")","instead","of","unnormalized","numbers",".","temperature","The","temperature","of","the","scoring","function"]
code: def __repr__(self):
      s = "{name}(alpha={alpha}, K={K}, from_logits={from_logits})"
      return s.format(
          name=self.__class__.__name__,
          alpha=self._alpha,
          K=self._K,
          from_logits=self._from_logits,
      )
  
imports: import warnings
  import mxnet
  import abc
  from mxnet.gluon import HybridBlock
  from typing import Callable, Optional
  from .layers import get_activation
label_desc: Use image node_id 4 for calling the BeamSearchScorer obj's underlying member method code with example usage: obj.__repr__() and returns: s