class_docstr: Here we also overwrite some of the tests of test_modeling_common.py, as MobileViT does not use input_ids, inputs_embeds,
  attention_mask and seq_length.
class_docstr_tok: ["Here","we","also","overwrite","some","of","the","tests","of","test_modeling_common.py",",","as","MobileViT","does","not","use","input_ids",",","inputs_embeds",",","attention_mask","and","seq_length","."]
code: def test_hidden_states_output(self):
      def check_hidden_states_output(inputs_dict, config, model_class):
          model = model_class(config)
  
          outputs = model(
              **self._prepare_for_class(inputs_dict, model_class)
          )
  
          hidden_states = outputs.hidden_states
  
          expected_num_stages = 5
          self.assertEqual(len(hidden_states), expected_num_stages)
  
          # MobileViT's feature maps are of shape (batch_size, num_channels, height, width)
          # with the width and height being successively divided by 2.
          divisor = 2
          for i in range(len(hidden_states)):
              self.assertListEqual(
                  list(hidden_states[i].shape[-2:]),
                  [
                      self.model_tester.image_size // divisor,
                      self.model_tester.image_size // divisor,
                  ],
              )
              divisor *= 2
  
          self.assertEqual(
              self.model_tester.output_stride, divisor // 2
          )
  
      (
          config,
          inputs_dict,
      ) = self.model_tester.prepare_config_and_inputs_for_common()
  
      for model_class in self.all_model_classes:
          inputs_dict["output_hidden_states"] = True
          check_hidden_states_output(inputs_dict, config, model_class)
  
          # check that output_hidden_states also work using config
          del inputs_dict["output_hidden_states"]
          config.output_hidden_states = True
  
          check_hidden_states_output(inputs_dict, config, model_class)
  
imports: from __future__ import annotations
  import inspect
  import unittest
  from transformers import MobileViTConfig
  from transformers.file_utils import is_tf_available, is_vision_available
  from transformers.testing_utils import require_tf, slow
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor
  from ...test_pipeline_mixin import PipelineTesterMixin
label_desc: Use image node_id 8 for calling the TFMobileViTModelTest obj's underlying member method code with example usage: obj.test_hidden_states_output() without return types