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: Maybe splits the tensor from a batch by beams into a batch of beams.
  
  We do this so that we can use nest and not run into problems with
  shapes.
  
  Args:
    t: `Tensor`, either scalar or shaped `[batch_size * beam_width] + s`.
    s: `Tensor`, Python int, or `TensorShape`.
  
  Returns:
    If `t` is a matrix or higher order tensor, then the return value is
    `t` reshaped to `[batch_size, beam_width] + s`.  Otherwise `t` is
    returned unchanged.
  
  Raises:
    ValueError: If the rank of `t` is not statically known.
docstr_tok: ["Maybe","splits","the","tensor","from","a","batch","by","beams","into","a","batch","of","beams",".","We","do","this","so","that","we","can","use","nest","and","not","run","into","problems","with","shapes",".","Args",":","t",":","`","Tensor","`",",","either","scalar","or","shaped","`","[","batch_size","*","beam_width","]","+","s","`",".","s",":","`","Tensor","`",",","Python","int",",","or","`","TensorShape","`",".","Returns",":","If","`","t","`","is","a","matrix","or","higher","order","tensor",",","then","the","return","value","is","`","t","`","reshaped","to","`","[","batch_size",",","beam_width","]","+","s","`",".","Otherwise","`","t","`","is","returned","unchanged",".","Raises",":","ValueError",":","If","the","rank","of","`","t","`","is","not","statically","known","."]
code: def _maybe_split_batch_beams(self, t, s):
      """Maybe splits the tensor from a batch by beams into a batch of beams.
  
      We do this so that we can use nest and not run into problems with
      shapes.
  
      Args:
        t: `Tensor`, either scalar or shaped `[batch_size * beam_width] + s`.
        s: `Tensor`, Python int, or `TensorShape`.
  
      Returns:
        If `t` is a matrix or higher order tensor, then the return value is
        `t` reshaped to `[batch_size, beam_width] + s`.  Otherwise `t` is
        returned unchanged.
  
      Raises:
        ValueError: If the rank of `t` is not statically known.
      """
      if isinstance(t, tf.TensorArray):
          return t
      _check_ndims(t)
      if t.shape.ndims >= 1:
          return self._split_batch_beams(t, s)
      else:
          return t
  
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 9 for calling the BeamSearchDecoderMixin obj's underlying member method code with example usage: obj._maybe_split_batch_beams(t, s) and returns: t, self, t