class_docstr: Tests :class:`~texar.tf.modules.decoders.rnn_decoders.BasicRNNDecoder`.
      
docstr: Tests decoding in inferencee mode.
          
docstr_tok: ["Tests","decoding","in","inferencee","mode","."]
code: def test_decode_infer(self):
      """Tests decoding in inferencee mode."""
      output_layer = tf.layers.Dense(self._vocab_size)
      decoder = BasicRNNDecoder(
          vocab_size=self._vocab_size, output_layer=output_layer
      )
  
      helper_infer = get_helper(
          decoder.hparams.helper_infer.type,
          embedding=self._embedding,
          start_tokens=[self._vocab_size - 2] * self._batch_size,
          end_token=self._vocab_size - 1,
          **decoder.hparams.helper_train.kwargs.todict(),
      )
  
      outputs, final_state, sequence_lengths = decoder(
          helper=helper_infer
      )
  
      # 4 trainable variables: embedding, cell-kernel, cell-bias,
      # fc-layer-weights, fc-layer-bias
      self.assertEqual(len(decoder.trainable_variables), 4)
  
      cell_dim = decoder.hparams.rnn_cell.kwargs.num_units
      with self.test_session() as sess:
          sess.run(tf.global_variables_initializer())
          outputs_, final_state_, sequence_lengths_ = sess.run(
              [outputs, final_state, sequence_lengths],
              feed_dict={
                  context.global_mode(): tf.estimator.ModeKeys.PREDICT
              },
          )
          self.assertIsInstance(outputs_, BasicRNNDecoderOutput)
          max_length = max(sequence_lengths_)
          self.assertEqual(
              outputs_.logits.shape,
              (self._batch_size, max_length, self._vocab_size),
          )
          self.assertEqual(
              outputs_.sample_id.shape, (self._batch_size, max_length)
          )
          self.assertEqual(
              final_state_[0].shape, (self._batch_size, cell_dim)
          )
  
imports: import numpy
  import tensorflow
  from texar.tf.modules.decoders.rnn_decoders import BasicRNNDecoderOutput
  from texar.tf.modules.decoders.rnn_decoders import BasicRNNDecoder
  from texar.tf.modules.decoders.rnn_decoders import AttentionRNNDecoderOutput
  from texar.tf.modules.decoders.rnn_decoders import AttentionRNNDecoder
  from texar.tf.modules.decoders.rnn_decoder_helpers import get_helper
  from texar.tf import context
label_desc: Use image node_id 6 for calling the BasicRNNDecoderTest obj's underlying member method code with example usage: obj.test_decode_infer() without return types