class_docstr: BeamSearchDecoderMixin contains the common methods for
  BeamSearchDecoder.
  
  It is expected to be used a base class for concrete
  BeamSearchDecoder. Since this is a mixin class, it is expected to be
  used together with other class as base.
docstr: Initialize the BeamSearchDecoderMixin.
  
  Args:
    cell: A layer that implements the `tf.keras.layers.AbstractRNNCell`
      interface.
    beam_width:  Python integer, the number of beams.
    output_layer: (Optional) An instance of `tf.keras.layers.Layer`,
      i.e., `tf.keras.layers.Dense`.  Optional layer to apply to the RNN
      output prior to storing the result or sampling.
    length_penalty_weight: Float weight to penalize length. Disabled with
       0.0.
    coverage_penalty_weight: Float weight to penalize the coverage of
      source sentence. Disabled with 0.0.
    reorder_tensor_arrays: If `True`, `TensorArray`s' elements within the
      cell state will be reordered according to the beam search path. If
      the `TensorArray` can be reordered, the stacked form will be
      returned. Otherwise, the `TensorArray` will be returned as is. Set
      this flag to `False` if the cell state contains `TensorArray`s that
      are not amenable to reordering.
    output_all_scores: If `True`, `BeamSearchDecoderOutput.scores` will
      contain scores for all token IDs and be of shape
      `[batch_size, beam_width, vocab_size]`. When `False` (default),
      only the top score corresponding to the predicted token will be
      output with shape `[batch_size, beam_width]`.
    **kwargs: Dict, other keyword arguments for parent class.
docstr_tok: ["Initialize","the","BeamSearchDecoderMixin",".","Args",":","cell",":","A","layer","that","implements","the","`","tf.keras.layers.AbstractRNNCell","`","interface",".","beam_width",":","Python","integer",",","the","number","of","beams",".","output_layer",":","(","Optional",")","An","instance","of","`","tf.keras.layers.Layer","`",",","i.e.",",","`","tf.keras.layers.Dense","`",".","Optional","layer","to","apply","to","the","RNN","output","prior","to","storing","the","result","or","sampling",".","length_penalty_weight",":","Float","weight","to","penalize","length",".","Disabled","with","0.0.","coverage_penalty_weight",":","Float","weight","to","penalize","the","coverage","of","source","sentence",".","Disabled","with","0.0.","reorder_tensor_arrays",":","If","`","True","`",",","`","TensorArray","`","s","'","elements","within","the","cell","state","will","be","reordered","according","to","the","beam","search","path",".","If","the","`","TensorArray","`","can","be","reordered",",","the","stacked","form","will","be","returned",".","Otherwise",",","the","`","TensorArray","`","will","be","returned","as","is",".","Set","this","flag","to","`","False","`","if","the","cell","state","contains","`","TensorArray","`","s","that","are","not","amenable","to","reordering",".","output_all_scores",":","If","`","True","`",",","`","BeamSearchDecoderOutput.scores","`","will","contain","scores","for","all","token","IDs","and","be","of","shape","`","[","batch_size",",","beam_width",",","vocab_size","]","`",".","When","`","False","`","(","default",")",",","only","the","top","score","corresponding","to","the","predicted","token","will","be","output","with","shape","`","[","batch_size",",","beam_width","]","`",".","*","*","kwargs",":","Dict",",","other","keyword","arguments","for","parent","class","."]
code: def __init__(
      self,
      cell: tf.keras.layers.Layer,
      beam_width: int,
      output_layer: Optional[tf.keras.layers.Layer] = None,
      length_penalty_weight: FloatTensorLike = 0.0,
      coverage_penalty_weight: FloatTensorLike = 0.0,
      reorder_tensor_arrays: bool = True,
      output_all_scores: bool = False,
      **kwargs,
  ):
      """Initialize the BeamSearchDecoderMixin.
  
      Args:
        cell: A layer that implements the `tf.keras.layers.AbstractRNNCell`
          interface.
        beam_width:  Python integer, the number of beams.
        output_layer: (Optional) An instance of `tf.keras.layers.Layer`,
          i.e., `tf.keras.layers.Dense`.  Optional layer to apply to the RNN
          output prior to storing the result or sampling.
        length_penalty_weight: Float weight to penalize length. Disabled with
           0.0.
        coverage_penalty_weight: Float weight to penalize the coverage of
          source sentence. Disabled with 0.0.
        reorder_tensor_arrays: If `True`, `TensorArray`s' elements within the
          cell state will be reordered according to the beam search path. If
          the `TensorArray` can be reordered, the stacked form will be
          returned. Otherwise, the `TensorArray` will be returned as is. Set
          this flag to `False` if the cell state contains `TensorArray`s that
          are not amenable to reordering.
        output_all_scores: If `True`, `BeamSearchDecoderOutput.scores` will
          contain scores for all token IDs and be of shape
          `[batch_size, beam_width, vocab_size]`. When `False` (default),
          only the top score corresponding to the predicted token will be
          output with shape `[batch_size, beam_width]`.
        **kwargs: Dict, other keyword arguments for parent class.
      """
      keras_utils.assert_like_rnncell("cell", cell)
      self._cell = cell
      self._output_layer = output_layer
      self._reorder_tensor_arrays = reorder_tensor_arrays
      self._output_all_scores = output_all_scores
  
      self._start_tokens = None
      self._end_token = None
      self._batch_size = None
      self._beam_width = beam_width
      self._length_penalty_weight = length_penalty_weight
      self._coverage_penalty_weight = coverage_penalty_weight
      super().__init__(**kwargs)
  
imports: import collections
  import numpy
  import tensorflow
  from tensorflow_addons import options
  from tensorflow_addons.seq2seq import attention_wrapper
  from tensorflow_addons.seq2seq import decoder
  from tensorflow_addons.utils import keras_utils
  from tensorflow_addons.utils.resource_loader import LazySO
  from tensorflow_addons.utils.types import FloatTensorLike, TensorLike, Number
  from typeguard import typechecked
  from typing import Callable, Optional
label_desc: Use image node_id 1 to create a new BeamSearchDecoderMixin object  with example: obj = BeamSearchDecoderMixin(cell, beam_width, output_layer, length_penalty_weight, coverage_penalty_weight, reorder_tensor_arrays, output_all_scores)