class_docstr: Tests :class:`~texar.tf.modules.XLNetEncoder` class.
      
docstr: Tests the priority of the encoder architecture parameter.
          
code: def test_hparams(self):
      """Tests the priority of the encoder architecture parameter."""
  
      inputs = tf.placeholder(dtype=tf.int32, shape=[None, None])
  
      # case 1: set "pretrained_mode_name" by constructor argument
      encoder = XLNetEncoder(
          pretrained_model_name="xlnet-large-cased", hparams={}
      )
      encoder(inputs)
      self.assertEqual(len(encoder.attn_layers), 24)
      self.assertEqual(len(encoder.ff_layers), 24)
  
      # case 2: set "pretrained_mode_name" by hparams
      hparams = {"pretrained_model_name": "xlnet-base-cased"}
      encoder = XLNetEncoder(hparams=hparams)
      encoder(inputs)
      self.assertEqual(len(encoder.attn_layers), 12)
      self.assertEqual(len(encoder.ff_layers), 12)
  
      # case 3: set to None in both hparams and constructor argument
      # load no pre-trained model
      hparams = {"pretrained_model_name": None, "num_layers": 16}
      encoder = XLNetEncoder(hparams=hparams)
      encoder(inputs)
      self.assertEqual(len(encoder.attn_layers), 16)
      self.assertEqual(len(encoder.ff_layers), 16)
  
      # case 4: using default hparams
      encoder = XLNetEncoder()
      encoder(inputs)
      self.assertEqual(len(encoder.attn_layers), 12)
      self.assertEqual(len(encoder.ff_layers), 12)
  
file_path: texar/tests/modules/encoders/xlnet_encoder_test.py
imports: import tensorflow
  from texar.tf.modules.encoders.xlnet_encoder import XLNetEncoder
  from texar.tf.utils.test import pretrained_test
label_desc: Use image node_id 2 for calling the XLNetEncoderTest obj's underlying member method code with example usage: obj.test_hparams() without return types