class_docstr: Here we also overwrite some of the tests of test_modeling_common.py, as CLIP 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","CLIP","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
  
          self.assertEqual(
              len(hidden_states),
              self.model_tester.num_hidden_layers + 1,
          )
  
          # CLIP has a different seq_length
          image_size = (
              self.model_tester.image_size,
              self.model_tester.image_size,
          )
          patch_size = (
              self.model_tester.patch_size,
              self.model_tester.patch_size,
          )
          num_patches = (image_size[1] // patch_size[1]) * (
              image_size[0] // patch_size[0]
          )
          seq_length = num_patches + 1
  
          self.assertListEqual(
              list(hidden_states[0].shape[-2:]),
              [seq_length, self.model_tester.hidden_size],
          )
  
      (
          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: import inspect
  import tempfile
  import unittest
  import numpy
  import transformers
  from transformers import CLIPConfig, CLIPTextConfig, CLIPVisionConfig, is_flax_available, is_torch_available
  from transformers.testing_utils import is_pt_flax_cross_test, require_flax, slow
  from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask
label_desc: Use image node_id 4 for calling the FlaxCLIPVisionModelTest obj's underlying member method code with example usage: obj.test_hidden_states_output() without return types