class_docstr: Draw samples from the decoder by beam search.
  
  Parameters
  ----------
  beam_size : int
      The beam size.
  decoder
      Function of the one-step-ahead decoder, should inherit SequenceDecoder and
      have the form::
  
          outputs, new_states = decoder(step_input, states)
  
      The outputs, input should follow these rules:
  
      - step_input has shape (batch_size,),
      - outputs has shape (batch_size, V),
      - states and new_states have the same structure.
  eos_id
      Id of the EOS token. No other elements will be appended to the sample if it reaches eos_id,
      if eos_id == None, beam will not die
  scorer : BeamSearchScorer, default BeamSearchScorer(alpha=1.0, K=5)
      The score function used in beam search.
  max_length_a
      The `a` value in the formula `a * x + b`. Generate sequences of maximum length `a * x + b`,
      where `x` is the maximum source length.
  max_length_b
      The b value in the formula `a * x + b`. Generate sequences of maximum length `a * x + b`,
      where `x` is the maximum source length.
  min_length
      The minimum length of the generated sequences.
  temperature
      The temperature.
  stochastic
      Whether to use stochastic beam search,
      see [ICML2019] "Stochastic Beams and Where to Find Them" for detail.
      https://arxiv.org/abs/1903.06059
  sampling
      Whether to use multinomial sampler.
  sampling_topp
      Multinomial sampling with topp,
      see [ICLR2020] "The Curious Case of Neural Text Degeneration"
      https://arxiv.org/abs/1904.09751
  sampling_topk
      Multinomial sampling with topk,
      see [ACL2018] "Hierarchical Neural Story Generation"
      https://www.aclweb.org/anthology/P18-1082.pdf
  early_return
      Whether to return when all beams are dead.
      Without early_return, the sequences will be generated until the
      maximum length is reached.
class_docstr_tok: ["Draw","samples","from","the","decoder","by","beam","search",".","Parameters","--","--","--","--","--","beam_size",":","int","The","beam","size",".","decoder","Function","of","the","one-step-ahead","decoder",",","should","inherit","SequenceDecoder","and","have","the","form",":",":","outputs",",","new_states","=","decoder","(","step_input",",","states",")","The","outputs",",","input","should","follow","these","rules",":","-","step_input","has","shape","(","batch_size",",",")",",","-","outputs","has","shape","(","batch_size",",","V",")",",","-","states","and","new_states","have","the","same","structure",".","eos_id","Id","of","the","EOS","token",".","No","other","elements","will","be","appended","to","the","sample","if","it","reaches","eos_id",",","if","eos_id","==","None",",","beam","will","not","die","scorer",":","BeamSearchScorer",",","default","BeamSearchScorer","(","alpha=1.0",",","K=5",")","The","score","function","used","in","beam","search",".","max_length_a","The","`","a","`","value","in","the","formula","`","a","*","x","+","b","`",".","Generate","sequences","of","maximum","length","`","a","*","x","+","b","`",",","where","`","x","`","is","the","maximum","source","length",".","max_length_b","The","b","value","in","the","formula","`","a","*","x","+","b","`",".","Generate","sequences","of","maximum","length","`","a","*","x","+","b","`",",","where","`","x","`","is","the","maximum","source","length",".","min_length","The","minimum","length","of","the","generated","sequences",".","temperature","The","temperature",".","stochastic","Whether","to","use","stochastic","beam","search",",","see","[","ICML2019","]","``","Stochastic","Beams","and","Where","to","Find","Them","''","for","detail",".","https",":","\/\/arxiv.org\/abs\/1903.06059","sampling","Whether","to","use","multinomial","sampler",".","sampling_topp","Multinomial","sampling","with","topp",",","see","[","ICLR2020","]","``","The","Curious","Case","of","Neural","Text","Degeneration","''","https",":","\/\/arxiv.org\/abs\/1904.09751","sampling_topk","Multinomial","sampling","with","topk",",","see","[","ACL2018","]","``","Hierarchical","Neural","Story","Generation","''","https",":","\/\/www.aclweb.org\/anthology\/P18-1082.pdf","early_return","Whether","to","return","when","all","beams","are","dead",".","Without","early_return",",","the","sequences","will","be","generated","until","the","maximum","length","is","reached","."]
code: def __repr__(self):
      ret = (
          "{name}:(\n"
          "  beam_size={beam_size}\n"
          "  eos_id={eos_id}\n"
          "  vocab_size={vocab_size}\n"
          "  max_length_a={max_length_a}\n"
          "  max_length_b={max_length_b}\n"
          "  scorer={scorer}\n"
          "  sampling={sampling}\n"
          "  stochastic_beam_search={stochastic}\n"
          "  sampling_topp={sampling_topp}\n"
          "  sampling_topk={sampling_topk}\n"
          ")".format(
              name=self.__class__.__name__,
              beam_size=self._beam_size,
              eos_id=self._eos_id,
              vocab_size=self._vocab_size,
              max_length_a=self._max_length_a,
              max_length_b=self._max_length_b,
              scorer=self._scorer,
              sampling=self._sampling,
              stochastic=self._stochastic,
              sampling_topp=self._sampling_topp,
              sampling_topk=self._sampling_topk,
          )
      )
      return ret
  
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 3 for calling the BeamSearchSampler obj's underlying member method code with example usage: obj.__repr__() and returns: ret