class_docstr: A collection of decoder tests. This class should be inherited together with
  `tf.test.TestCase`.
class_docstr_tok: ["A","collection","of","decoder","tests",".","This","class","should","be","inherited","together","with","`","tf.test.TestCase","`","."]
code: def test_with_beam_search(self):
      self.batch_size = 1
  
      # Batch size for beam search must be 1.
      config = beam_search.BeamSearchConfig(
          beam_width=10,
          vocab_size=self.vocab_size,
          eos_token=self.vocab_size - 2,
          length_penalty_weight=0.6,
          choose_successors_fn=beam_search.choose_top_k,
      )
  
      embeddings = tf.get_variable(
          "W_embed", [self.vocab_size, self.input_depth]
      )
  
      helper = decode_helper.GreedyEmbeddingHelper(
          embedding=embeddings,
          start_tokens=[0] * config.beam_width,
          end_token=-1,
      )
      decoder_fn = self.create_decoder(
          helper=helper, mode=tf.contrib.learn.ModeKeys.INFER
      )
      decoder_fn = beam_search_decoder.BeamSearchDecoder(
          decoder=decoder_fn, config=config
      )
  
      initial_state = decoder_fn.cell.zero_state(
          self.batch_size, dtype=tf.float32
      )
      decoder_output, _ = decoder_fn(initial_state, helper)
  
      # pylint: disable=E1101
      with self.test_session() as sess:
          sess.run(tf.global_variables_initializer())
          decoder_output_ = sess.run(decoder_output)
  
      np.testing.assert_array_equal(
          decoder_output_.predicted_ids.shape,
          [self.max_decode_length, 1, config.beam_width],
      )
      np.testing.assert_array_equal(
          decoder_output_.beam_search_output.beam_parent_ids.shape,
          [self.max_decode_length, 1, config.beam_width],
      )
      np.testing.assert_array_equal(
          decoder_output_.beam_search_output.scores.shape,
          [self.max_decode_length, 1, config.beam_width],
      )
      np.testing.assert_array_equal(
          decoder_output_.beam_search_output.original_outputs.predicted_ids.shape,
          [self.max_decode_length, 1, config.beam_width],
      )
      np.testing.assert_array_equal(
          decoder_output_.beam_search_output.original_outputs.logits.shape,
          [
              self.max_decode_length,
              1,
              config.beam_width,
              self.vocab_size,
          ],
      )
  
      return decoder_output
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import tensorflow
  import numpy
  from seq2seq.decoders import BasicDecoder, AttentionDecoder, AttentionLayerDot
  from seq2seq.decoders import beam_search_decoder
  from seq2seq.inference import beam_search
  from seq2seq.contrib.seq2seq import helper
label_desc: Use image node_id 6 for calling the DecoderTests obj's underlying member method code with example usage: obj.test_with_beam_search() and returns: decoder_output