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"]
docstr: Compute new scores of each candidate
  
  Parameters
  ----------
  outputs : mx.np.ndarray
      If from_logits is True, outputs is the log probabilities of the candidates.
      Shape (d1, d2, ..., dn, V).
      Otherwise, outputs is the unnormalized outputs from predictor of the same shape,
      before softmax/log_softmax.
  scores : mx.np.ndarray
      The original scores of the beams. Shape (d1, d2, ..., dn)
  step : mx.np.ndarray
      Step to calculate the score function. It starts from 1. The shape is a scalar.
  
  Returns
  -------
  candidate_scores : mx.np.ndarray
      The scores of all the candidates. Shape (d1, d2, ..., dn, V), where V is the size
      of the vocabulary.
docstr_tok: ["Compute","new","scores","of","each","candidate","Parameters","--","--","--","--","--","outputs",":","mx.np.ndarray","If","from_logits","is","True",",","outputs","is","the","log","probabilities","of","the","candidates",".","Shape","(","d1",",","d2",",","...",",","dn",",","V",")",".","Otherwise",",","outputs","is","the","unnormalized","outputs","from","predictor","of","the","same","shape",",","before","softmax\/log_softmax",".","scores",":","mx.np.ndarray","The","original","scores","of","the","beams",".","Shape","(","d1",",","d2",",","...",",","dn",")","step",":","mx.np.ndarray","Step","to","calculate","the","score","function",".","It","starts","from","1",".","The","shape","is","a","scalar",".","Returns","--","--","--","-","candidate_scores",":","mx.np.ndarray","The","scores","of","all","the","candidates",".","Shape","(","d1",",","d2",",","...",",","dn",",","V",")",",","where","V","is","the","size","of","the","vocabulary","."]
code: def __call__(
      self, outputs, scores, step
  ):  # pylint: disable=arguments-differ
      """Compute new scores of each candidate
  
      Parameters
      ----------
      outputs : mx.np.ndarray
          If from_logits is True, outputs is the log probabilities of the candidates.
          Shape (d1, d2, ..., dn, V).
          Otherwise, outputs is the unnormalized outputs from predictor of the same shape,
          before softmax/log_softmax.
      scores : mx.np.ndarray
          The original scores of the beams. Shape (d1, d2, ..., dn)
      step : mx.np.ndarray
          Step to calculate the score function. It starts from 1. The shape is a scalar.
  
      Returns
      -------
      candidate_scores : mx.np.ndarray
          The scores of all the candidates. Shape (d1, d2, ..., dn, V), where V is the size
          of the vocabulary.
      """
      return super().__call__(outputs, scores, step)
  
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 2 for calling the BeamSearchScorer obj's underlying member method code with example usage: obj.__call__(outputs, scores, step) and returns: super