class_docstr: Tests :class:`~texar.tf.modules.UnidirectionalRNNEncoder` class.
      
class_docstr_tok: ["Tests",":","class",":","`","~texar.tf.modules.UnidirectionalRNNEncoder","`","class","."]
docstr: Tests the functionality of automatically collecting trainable
  variables.
docstr_tok: ["Tests","the","functionality","of","automatically","collecting","trainable","variables","."]
code: def test_trainable_variables(self):
      """Tests the functionality of automatically collecting trainable
      variables.
      """
      inputs = tf.placeholder(dtype=tf.float32, shape=[None, None, 100])
  
      # case 1
      encoder = UnidirectionalRNNEncoder()
      _, _ = encoder(inputs)
      self.assertEqual(len(encoder.trainable_variables), 2)
  
      # case 2
      hparams = {"rnn_cell": {"dropout": {"input_keep_prob": 0.5}}}
      encoder = UnidirectionalRNNEncoder(hparams=hparams)
      _, _ = encoder(inputs)
      self.assertEqual(len(encoder.trainable_variables), 2)
  
      # case 3
      hparams = {
          "output_layer": {
              "num_layers": 2,
              "layer_size": [100, 6],
              "activation": "relu",
              "final_layer_activation": "identity",
              "dropout_layer_ids": [0, 1, 2],
              "variational_dropout": False,
          }
      }
      encoder = UnidirectionalRNNEncoder(hparams=hparams)
      _, _ = encoder(inputs)
      self.assertEqual(len(encoder.trainable_variables), 2 + 2 + 2)
      _, _ = encoder(inputs)
      self.assertEqual(len(encoder.trainable_variables), 2 + 2 + 2)
  
file_path: texar/tests/modules/encoders/rnn_encoders_test.py
imports: import tensorflow
  from texar.tf.modules.encoders.rnn_encoders import UnidirectionalRNNEncoder
  from texar.tf.modules.encoders.rnn_encoders import BidirectionalRNNEncoder
  from texar.tf.modules.embedders.embedders import WordEmbedder
label_desc: Use image node_id 1 for calling the UnidirectionalRNNEncoderTest obj's underlying member method code with example usage: obj.test_trainable_variables() without return types