code: def test_hidden_states_output(self):
      (
          config,
          inputs_dict,
      ) = self.model_tester.prepare_config_and_inputs_for_common()
  
      def check_hidden_states_output(config, inputs_dict, model_class):
          model = model_class(config)
          outputs = model(
              self._prepare_for_class(inputs_dict, model_class)
          )
          language_hidden_states, vision_hidden_states = (
              outputs[-2],
              outputs[-1],
          )
  
          self.assertEqual(
              len(language_hidden_states),
              self.model_tester.num_hidden_layers["language"] + 1,
          )
          self.assertEqual(
              len(vision_hidden_states),
              self.model_tester.num_hidden_layers["vision"] + 1,
          )
  
          seq_length = self.model_tester.seq_length
          num_visual_features = self.model_tester.num_visual_features
  
          self.assertListEqual(
              list(language_hidden_states[0].shape[-2:]),
              [seq_length, self.model_tester.hidden_size],
          )
          self.assertListEqual(
              list(vision_hidden_states[0].shape[-2:]),
              [num_visual_features, self.model_tester.hidden_size],
          )
  
      for model_class in self.all_model_classes:
          inputs_dict["output_hidden_states"] = True
          check_hidden_states_output(config, inputs_dict, model_class)
  
          del inputs_dict["output_hidden_states"]
          config.output_hidden_states = True
          check_hidden_states_output(config, inputs_dict, model_class)
  
imports: import os
  import tempfile
  import unittest
  import numpy
  from transformers import LxmertConfig, is_tf_available
  from transformers.testing_utils import require_tf, slow, tooslow
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
label_desc: Use image node_id 7 for calling the TFLxmertModelTest obj's underlying member method code with example usage: obj.test_hidden_states_output() without return types