class_docstr: Tests :class:`~texar.tf.modules.BERTEncoder` class.
      
docstr: 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.int32, shape=[None, None])
  
      # case 1: bert base
      encoder = BERTEncoder()
      _, _ = encoder(inputs)
      self.assertEqual(
          len(encoder.trainable_variables), 3 + 2 + 12 * 16 + 2
      )
  
      # case 2: bert large
      hparams = {"pretrained_model_name": "bert-large-uncased"}
      encoder = BERTEncoder(hparams=hparams)
      _, _ = encoder(inputs)
      self.assertEqual(
          len(encoder.trainable_variables), 3 + 2 + 24 * 16 + 2
      )
  
      # case 3: self-designed bert
      hparams = {
          "encoder": {
              "num_blocks": 6,
          },
          "pretrained_model_name": None,
      }
      encoder = BERTEncoder(hparams=hparams)
      _, _ = encoder(inputs)
      self.assertEqual(
          len(encoder.trainable_variables), 3 + 2 + 6 * 16 + 2
      )
  
file_path: texar/tests/modules/encoders/bert_encoder_test.py
imports: import tensorflow
  from texar.tf.modules.encoders.bert_encoder import BERTEncoder
  from texar.tf.utils.test import pretrained_test
label_desc: Use image node_id 3 for calling the BERTEncoderTest obj's underlying member method code with example usage: obj.test_trainable_variables() without return types