class_docstr: Tests :class:`~texar.tf.modules.BERTEncoder` class.
      
docstr: Tests the priority of the encoder arch parameter.
          
code: def test_hparams(self):
      """Tests the priority of the encoder arch parameter."""
  
      inputs = tf.placeholder(dtype=tf.int32, shape=[None, None])
  
      # case 1: set "pretrained_mode_name" by constructor argument
      hparams = {
          "pretrained_model_name": "bert-large-uncased",
      }
      encoder = BERTEncoder(
          pretrained_model_name="bert-base-uncased", hparams=hparams
      )
      _, _ = encoder(inputs)
      self.assertEqual(encoder.hparams.encoder.num_blocks, 12)
  
      # case 2: set "pretrained_mode_name" by hparams
      hparams = {
          "pretrained_model_name": "bert-large-uncased",
          "encoder": {"num_blocks": 6},
      }
      encoder = BERTEncoder(hparams=hparams)
      _, _ = encoder(inputs)
      self.assertEqual(encoder.hparams.encoder.num_blocks, 24)
  
      # case 3: set to None in both hparams and constructor argument
      hparams = {
          "pretrained_model_name": None,
          "encoder": {"num_blocks": 6},
      }
      encoder = BERTEncoder(hparams=hparams)
      _, _ = encoder(inputs)
      self.assertEqual(encoder.hparams.encoder.num_blocks, 6)
  
      # case 4: using default hparams
      encoder = BERTEncoder()
      _, _ = encoder(inputs)
      self.assertEqual(encoder.hparams.encoder.num_blocks, 12)
  
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 2 for calling the BERTEncoderTest obj's underlying member method code with example usage: obj.test_hparams() without return types