


import inspect
import unittest

from transformers import SegformerConfig, is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
     import torch

     from transformers import (
         MODEL_MAPPING,
         SegformerForImageClassification,
         SegformerForSemanticSegmentation,
         SegformerModel,
     )
     from transformers.models.segformer.modeling_segformer import SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
     from PIL import Image

     from transformers import SegformerImageProcessor






class   _lowerCamelCase (					UpperCamelCase			):




       """simple docstring"""



       def        _snake_case       (      self		)->Union[str, Any]:




         '''simple docstring'''





         A_      :				int		     =					self.config_class(**self.inputs_dict		)
         self.parent.assertTrue(hasattr(_SCREAMING_SNAKE_CASE				,       '''hidden_sizes'''		)		)
         self.parent.assertTrue(hasattr(_SCREAMING_SNAKE_CASE				,       '''num_attention_heads'''		)		)
         self.parent.assertTrue(hasattr(_SCREAMING_SNAKE_CASE				,       '''num_encoder_blocks'''		)		)






class   _lowerCamelCase :




       """simple docstring"""



       def __init__(      self				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE=13				,       _SCREAMING_SNAKE_CASE=64				,       _SCREAMING_SNAKE_CASE=3				,       _SCREAMING_SNAKE_CASE=4				,       _SCREAMING_SNAKE_CASE=[2, 2, 2, 2]				,       _SCREAMING_SNAKE_CASE=[8, 4, 2, 1]				,       _SCREAMING_SNAKE_CASE=[16, 32, 64, 128]				,       _SCREAMING_SNAKE_CASE=[1, 4, 8, 16]				,       _SCREAMING_SNAKE_CASE=[1, 2, 4, 8]				,       _SCREAMING_SNAKE_CASE=True				,       _SCREAMING_SNAKE_CASE=True				,       _SCREAMING_SNAKE_CASE="gelu"				,       _SCREAMING_SNAKE_CASE=0.1				,       _SCREAMING_SNAKE_CASE=0.1				,       _SCREAMING_SNAKE_CASE=0.0_2				,       _SCREAMING_SNAKE_CASE=3				,       _SCREAMING_SNAKE_CASE=None				,       )->Dict:




         '''simple docstring'''





         A_      :				int		     =					parent
         A_      :				str		     =					batch_size
         A_      :				List[str]		     =					image_size
         A_      :				Any		     =					num_channels
         A_      :				Tuple		     =					num_encoder_blocks
         A_      :				Optional[Any]		     =					sr_ratios
         A_      :				Dict		     =					depths
         A_      :				Dict		     =					hidden_sizes
         A_      :				Optional[Any]		     =					downsampling_rates
         A_      :				int		     =					num_attention_heads
         A_      :				Tuple		     =					is_training
         A_      :				Any		     =					use_labels
         A_      :				int		     =					hidden_act
         A_      :				Dict		     =					hidden_dropout_prob
         A_      :				Any		     =					attention_probs_dropout_prob
         A_      :				Tuple		     =					initializer_range
         A_      :				Optional[Any]		     =					num_labels
         A_      :				Dict		     =					scope



       def        _snake_case       (      self		)->Optional[Any]:




         '''simple docstring'''





         A_      :				Optional[Any]		     =					floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]		)

         A_      :				Any		     =					None
         if self.use_labels:
           A_      :				Optional[Any]		     =					ids_tensor([self.batch_size, self.image_size, self.image_size]				,       self.num_labels		)

         A_      :				str		     =					self.get_config()
         return config, pixel_values, labels



       def        _snake_case       (      self		)->Any:




         '''simple docstring'''





         return SegformerConfig(
             image_size=self.image_size				,       num_channels=self.num_channels				,       num_encoder_blocks=self.num_encoder_blocks				,       depths=self.depths				,       hidden_sizes=self.hidden_sizes				,       num_attention_heads=self.num_attention_heads				,       hidden_act=self.hidden_act				,       hidden_dropout_prob=self.hidden_dropout_prob				,       attention_probs_dropout_prob=self.attention_probs_dropout_prob				,       initializer_range=self.initializer_range				,       )



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE		)->Tuple:




         '''simple docstring'''





         A_      :				Dict		     =					SegformerModel(config=_SCREAMING_SNAKE_CASE		)
         model.to(_SCREAMING_SNAKE_CASE		)
         model.eval()
         A_      :				str		     =					model(_SCREAMING_SNAKE_CASE		)
         A_      :				List[Any]		     =					self.image_size // (self.downsampling_rates[-1] * 2)
         self.parent.assertEqual(
             result.last_hidden_state.shape				,       (self.batch_size, self.hidden_sizes[-1], expected_height, expected_width)		)



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE		)->Any:




         '''simple docstring'''





         A_      :				Tuple		     =					self.num_labels
         A_      :				List[Any]		     =					SegformerForSemanticSegmentation(_SCREAMING_SNAKE_CASE		)
         model.to(_SCREAMING_SNAKE_CASE		)
         model.eval()
         A_      :				int		     =					model(_SCREAMING_SNAKE_CASE		)
         self.parent.assertEqual(
             result.logits.shape				,       (self.batch_size, self.num_labels, self.image_size // 4, self.image_size // 4)		)
         A_      :				Tuple		     =					model(_SCREAMING_SNAKE_CASE				,       labels=_SCREAMING_SNAKE_CASE		)
         self.parent.assertEqual(
             result.logits.shape				,       (self.batch_size, self.num_labels, self.image_size // 4, self.image_size // 4)		)
         self.parent.assertGreater(result.loss				,       0.0		)



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE		)->Tuple:




         '''simple docstring'''





         A_      :				int		     =					1
         A_      :				Dict		     =					SegformerForSemanticSegmentation(config=_SCREAMING_SNAKE_CASE		)
         model.to(_SCREAMING_SNAKE_CASE		)
         model.eval()
         A_      :				List[Any]		     =					torch.randint(0				,       1				,       (self.batch_size, self.image_size, self.image_size)		).to(_SCREAMING_SNAKE_CASE		)
         A_      :				Any		     =					model(_SCREAMING_SNAKE_CASE				,       labels=_SCREAMING_SNAKE_CASE		)
         self.parent.assertGreater(result.loss				,       0.0		)







       def        _snake_case       (      self		)->List[Any]:




         '''simple docstring'''





         A_      :				Optional[Any]		     =					self.prepare_config_and_inputs()
         A_     ,       A_     ,       A_      :				int		     =					config_and_inputs
         A_      :				Union[str, Any]		     =					{'''pixel_values''': pixel_values}
         return config, inputs_dict






@require_torch
class   _lowerCamelCase (					UpperCamelCase					,							UpperCamelCase					,							unittest.TestCase			):




       """simple docstring"""
       snake_case      =    (
           (
               SegformerModel,
               SegformerForSemanticSegmentation,
               SegformerForImageClassification,
           )
           if is_torch_available()
           else ()
       )
       snake_case      =    (
           {
               "feature-extraction": SegformerModel,
               "image-classification": SegformerForImageClassification,
               "image-segmentation": SegformerForSemanticSegmentation,
           }
           if is_torch_available()
           else {}
       )

       snake_case      =    True
       snake_case      =    False
       snake_case      =    False
       snake_case      =    False



       def        _snake_case       (      self		)->Tuple:




         '''simple docstring'''





         A_      :				Optional[Any]		     =					SegformerModelTester(self		)
         A_      :				Optional[int]		     =					SegformerConfigTester(self				,       config_class=_SCREAMING_SNAKE_CASE		)



       def        _snake_case       (      self		)->List[str]:




         '''simple docstring'''





         self.config_tester.run_common_tests()



       def        _snake_case       (      self		)->Any:




         '''simple docstring'''





         A_      :				List[str]		     =					self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_model(*_SCREAMING_SNAKE_CASE		)



       def        _snake_case       (      self		)->int:




         '''simple docstring'''





         A_      :				Dict		     =					self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_for_binary_image_segmentation(*_SCREAMING_SNAKE_CASE		)



       def        _snake_case       (      self		)->Any:




         '''simple docstring'''





         A_      :				Tuple		     =					self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_for_image_segmentation(*_SCREAMING_SNAKE_CASE		)



       @unittest.skip('''SegFormer does not use inputs_embeds'''		)
       def        _snake_case       (      self		)->Any:




         '''simple docstring'''





         pass



       @unittest.skip('''SegFormer does not have get_input_embeddings method and get_output_embeddings methods'''		)
       def        _snake_case       (      self		)->Optional[int]:




         '''simple docstring'''





         pass



       def        _snake_case       (      self		)->Tuple:




         '''simple docstring'''





         A_     ,       A_      :				str		     =					self.model_tester.prepare_config_and_inputs_for_common()

         for model_class in self.all_model_classes:
           A_      :				Dict		     =					model_class(_SCREAMING_SNAKE_CASE		)
           A_      :				Optional[int]		     =					inspect.signature(model.forward		)
           # signature.parameters is an OrderedDict => so arg_names order is deterministic
           A_      :				Any		     =					[*signature.parameters.keys()]

           A_      :				int		     =					['''pixel_values''']
           self.assertListEqual(arg_names[:1]				,       _SCREAMING_SNAKE_CASE		)



       def        _snake_case       (      self		)->Any:




         '''simple docstring'''





         A_     ,       A_      :				int		     =					self.model_tester.prepare_config_and_inputs_for_common()
         A_      :				Optional[Any]		     =					True

         for model_class in self.all_model_classes:
           A_      :				int		     =					True
           A_      :				List[str]		     =					False
           A_      :				int		     =					True
           A_      :				Dict		     =					model_class(_SCREAMING_SNAKE_CASE		)
           model.to(_SCREAMING_SNAKE_CASE		)
           model.eval()
           with torch.no_grad():
             A_      :				Dict		     =					model(**self._prepare_for_class(_SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE		)		)
           A_      :				Dict		     =					outputs.attentions

           A_      :				Optional[int]		     =					sum(self.model_tester.depths		)
           self.assertEqual(len(_SCREAMING_SNAKE_CASE		)				,       _SCREAMING_SNAKE_CASE		)

           # check that output_attentions also work using config
           del inputs_dict["output_attentions"]
           A_      :				int		     =					True
           A_      :				Dict		     =					model_class(_SCREAMING_SNAKE_CASE		)
           model.to(_SCREAMING_SNAKE_CASE		)
           model.eval()
           with torch.no_grad():
             A_      :				Dict		     =					model(**self._prepare_for_class(_SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE		)		)
           A_      :				int		     =					outputs.attentions

           self.assertEqual(len(_SCREAMING_SNAKE_CASE		)				,       _SCREAMING_SNAKE_CASE		)

           # verify the first attentions (first block, first layer)
           A_      :				Optional[int]		     =					(self.model_tester.image_size // 4) ** 2
           A_      :				Any		     =					(self.model_tester.image_size // (4 * self.model_tester.sr_ratios[0])) ** 2
           self.assertListEqual(
               list(attentions[0].shape[-3:]		)				,       [self.model_tester.num_attention_heads[0], expected_seq_len, expected_reduced_seq_len]				,       )

           # verify the last attentions (last block, last layer)
           A_      :				List[Any]		     =					(self.model_tester.image_size // 32) ** 2
           A_      :				str		     =					(self.model_tester.image_size // (32 * self.model_tester.sr_ratios[-1])) ** 2
           self.assertListEqual(
               list(attentions[-1].shape[-3:]		)				,       [self.model_tester.num_attention_heads[-1], expected_seq_len, expected_reduced_seq_len]				,       )
           A_      :				Any		     =					len(_SCREAMING_SNAKE_CASE		)

           # Check attention is always last and order is fine
           A_      :				Union[str, Any]		     =					True
           A_      :				Optional[int]		     =					True
           A_      :				int		     =					model_class(_SCREAMING_SNAKE_CASE		)
           model.to(_SCREAMING_SNAKE_CASE		)
           model.eval()
           with torch.no_grad():
             A_      :				Tuple		     =					model(**self._prepare_for_class(_SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE		)		)

           self.assertEqual(out_len + 1				,       len(_SCREAMING_SNAKE_CASE		)		)

           A_      :				int		     =					outputs.attentions

           self.assertEqual(len(_SCREAMING_SNAKE_CASE		)				,       _SCREAMING_SNAKE_CASE		)
           # verify the first attentions (first block, first layer)
           A_      :				List[Any]		     =					(self.model_tester.image_size // 4) ** 2
           A_      :				Union[str, Any]		     =					(self.model_tester.image_size // (4 * self.model_tester.sr_ratios[0])) ** 2
           self.assertListEqual(
               list(self_attentions[0].shape[-3:]		)				,       [self.model_tester.num_attention_heads[0], expected_seq_len, expected_reduced_seq_len]				,       )



       def        _snake_case       (      self		)->Optional[int]:




         '''simple docstring'''





         def check_hidden_states_output(_SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE		):
           A_      :				List[str]		     =					model_class(_SCREAMING_SNAKE_CASE		)
           model.to(_SCREAMING_SNAKE_CASE		)
           model.eval()

           with torch.no_grad():
             A_      :				Union[str, Any]		     =					model(**self._prepare_for_class(_SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE		)		)

           A_      :				Optional[int]		     =					outputs.hidden_states

           A_      :				str		     =					self.model_tester.num_encoder_blocks
           self.assertEqual(len(_SCREAMING_SNAKE_CASE		)				,       _SCREAMING_SNAKE_CASE		)

           # verify the first hidden states (first block)
           self.assertListEqual(
               list(hidden_states[0].shape[-3:]		)				,       [
                   self.model_tester.hidden_sizes[0],
                   self.model_tester.image_size // 4,
                   self.model_tester.image_size // 4,
               ]				,       )

         A_     ,       A_      :				int		     =					self.model_tester.prepare_config_and_inputs_for_common()

         for model_class in self.all_model_classes:
           A_      :				List[Any]		     =					True
           check_hidden_states_output(_SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE		)

           # check that output_hidden_states also work using config
           del inputs_dict["output_hidden_states"]
           A_      :				Any		     =					True

           check_hidden_states_output(_SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE		)



       def        _snake_case       (      self		)->Union[str, Any]:




         '''simple docstring'''





         if not self.model_tester.is_training:
           return

         A_     ,       A_      :				Any		     =					self.model_tester.prepare_config_and_inputs_for_common()
         A_      :				Optional[Any]		     =					True

         for model_class in self.all_model_classes:
           if model_class in get_values(_SCREAMING_SNAKE_CASE		):
             continue

           A_      :				Optional[int]		     =					model_class(_SCREAMING_SNAKE_CASE		)
           model.to(_SCREAMING_SNAKE_CASE		)
           model.train()
           A_      :				int		     =					self._prepare_for_class(_SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE				,       return_labels=_SCREAMING_SNAKE_CASE		)
           A_      :				Union[str, Any]		     =					model(**_SCREAMING_SNAKE_CASE		).loss
           loss.backward()



       @unittest.skip('''Will be fixed soon by reducing the size of the model used for common tests.'''		)
       def        _snake_case       (      self		)->Dict:




         '''simple docstring'''





         pass







       @slow
       def        _snake_case       (      self		)->str:




         '''simple docstring'''





         for model_name in SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
           A_      :				str		     =					SegformerModel.from_pretrained(_SCREAMING_SNAKE_CASE		)
           self.assertIsNotNone(_SCREAMING_SNAKE_CASE		)




def   _SCREAMING_SNAKE_CASE	( ):
  A_      :				List[str]		     =					Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''       )
  return image







@require_torch
class   _lowerCamelCase (					unittest.TestCase			):




       """simple docstring"""



       @slow
       def        _snake_case       (      self		)->Dict:




         '''simple docstring'''





         A_      :				List[Any]		     =					SegformerImageProcessor(
             image_scale=(512, 512)				,       keep_ratio=_SCREAMING_SNAKE_CASE				,       align=_SCREAMING_SNAKE_CASE				,       do_random_crop=_SCREAMING_SNAKE_CASE		)
         A_      :				Dict		     =					SegformerForSemanticSegmentation.from_pretrained('''nvidia/segformer-b0-finetuned-ade-512-512'''		).to(
             _SCREAMING_SNAKE_CASE		)

         A_      :				Optional[int]		     =					prepare_img()
         A_      :				List[str]		     =					image_processor(images=_SCREAMING_SNAKE_CASE				,       return_tensors='''pt'''		)
         A_      :				Optional[int]		     =					encoded_inputs.pixel_values.to(_SCREAMING_SNAKE_CASE		)

         with torch.no_grad():
           A_      :				Dict		     =					model(_SCREAMING_SNAKE_CASE		)

         A_      :				Optional[int]		     =					torch.Size((1, model.config.num_labels, 128, 128)		)
         self.assertEqual(outputs.logits.shape				,       _SCREAMING_SNAKE_CASE		)

         A_      :				str		     =					torch.tensor(
             [
                 [[-4.6_3_1_0, -5.5_2_3_2, -6.2_3_5_6], [-5.1_9_2_1, -6.1_4_4_4, -6.5_9_9_6], [-5.4_4_2_4, -6.2_7_9_0, -6.7_5_7_4]],
                 [[-1_2.1_3_9_1, -1_3.3_1_2_2, -1_3.9_5_5_4], [-1_2.8_7_3_2, -1_3.9_3_5_2, -1_4.3_5_6_3], [-1_2.9_4_3_8, -1_3.8_2_2_6, -1_4.2_5_1_3]],
                 [[-1_2.5_1_3_4, -1_3.4_6_8_6, -1_4.4_9_1_5], [-1_2.8_6_6_9, -1_4.4_3_4_3, -1_4.7_7_5_8], [-1_3.2_5_2_3, -1_4.5_8_1_9, -1_5.0_6_9_4]],
             ]		).to(_SCREAMING_SNAKE_CASE		)
         self.assertTrue(torch.allclose(outputs.logits[0, :3, :3, :3]				,       _SCREAMING_SNAKE_CASE				,       atol=1e-4		)		)



       @slow
       def        _snake_case       (      self		)->Union[str, Any]:




         '''simple docstring'''





         A_      :				Union[str, Any]		     =					SegformerImageProcessor(
             image_scale=(512, 512)				,       keep_ratio=_SCREAMING_SNAKE_CASE				,       align=_SCREAMING_SNAKE_CASE				,       do_random_crop=_SCREAMING_SNAKE_CASE		)
         A_      :				Optional[int]		     =					SegformerForSemanticSegmentation.from_pretrained(
             '''nvidia/segformer-b1-finetuned-cityscapes-1024-1024'''		).to(_SCREAMING_SNAKE_CASE		)

         A_      :				List[str]		     =					prepare_img()
         A_      :				str		     =					image_processor(images=_SCREAMING_SNAKE_CASE				,       return_tensors='''pt'''		)
         A_      :				List[Any]		     =					encoded_inputs.pixel_values.to(_SCREAMING_SNAKE_CASE		)

         with torch.no_grad():
           A_      :				Dict		     =					model(_SCREAMING_SNAKE_CASE		)

         A_      :				int		     =					torch.Size((1, model.config.num_labels, 128, 128)		)
         self.assertEqual(outputs.logits.shape				,       _SCREAMING_SNAKE_CASE		)

         A_      :				str		     =					torch.tensor(
             [
                 [[-1_3.5_7_4_8, -1_3.9_1_1_1, -1_2.6_5_0_0], [-1_4.3_5_0_0, -1_5.3_6_8_3, -1_4.2_3_2_8], [-1_4.7_5_3_2, -1_6.0_4_2_4, -1_5.6_0_8_7]],
                 [[-1_7.1_6_5_1, -1_5.8_7_2_5, -1_2.9_6_5_3], [-1_7.2_5_8_0, -1_7.3_7_1_8, -1_4.8_2_2_3], [-1_6.6_0_5_8, -1_6.8_7_8_3, -1_6.7_4_5_2]],
                 [[-3.6_4_5_6, -3.0_2_0_9, -1.4_2_0_3], [-3.0_7_9_7, -3.1_9_5_9, -2.0_0_0_0], [-1.8_7_5_7, -1.9_2_1_7, -1.6_9_9_7]],
             ]		).to(_SCREAMING_SNAKE_CASE		)
         self.assertTrue(torch.allclose(outputs.logits[0, :3, :3, :3]				,       _SCREAMING_SNAKE_CASE				,       atol=1e-1		)		)







       @slow
       def        _snake_case       (      self		)->List[str]:




         '''simple docstring'''





         A_      :				str		     =					SegformerImageProcessor(
             image_scale=(512, 512)				,       keep_ratio=_SCREAMING_SNAKE_CASE				,       align=_SCREAMING_SNAKE_CASE				,       do_random_crop=_SCREAMING_SNAKE_CASE		)
         A_      :				Tuple		     =					SegformerForSemanticSegmentation.from_pretrained('''nvidia/segformer-b0-finetuned-ade-512-512'''		).to(
             _SCREAMING_SNAKE_CASE		)

         A_      :				str		     =					prepare_img()
         A_      :				Optional[int]		     =					image_processor(images=_SCREAMING_SNAKE_CASE				,       return_tensors='''pt'''		)
         A_      :				List[str]		     =					encoded_inputs.pixel_values.to(_SCREAMING_SNAKE_CASE		)

         with torch.no_grad():
           A_      :				str		     =					model(_SCREAMING_SNAKE_CASE		)

         A_      :				List[Any]		     =					outputs.logits.detach().cpu()

         A_      :				List[str]		     =					image_processor.post_process_semantic_segmentation(outputs=_SCREAMING_SNAKE_CASE				,       target_sizes=[(500, 300)]		)
         A_      :				Optional[int]		     =					torch.Size((500, 300)		)
         self.assertEqual(segmentation[0].shape				,       _SCREAMING_SNAKE_CASE		)

         A_      :				List[str]		     =					image_processor.post_process_semantic_segmentation(outputs=_SCREAMING_SNAKE_CASE		)
         A_      :				Dict		     =					torch.Size((128, 128)		)
         self.assertEqual(segmentation[0].shape				,       _SCREAMING_SNAKE_CASE		)








from ...configuration_utils import PretrainedConfig
from ...utils import logging


UpperCamelCase								=	logging.get_logger(__name__)

UpperCamelCase								=	{
    """vinvino02/glpn-kitti""": """https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json""",
    # See all GLPN models at https://huggingface.co/models?filter=glpn
}






class   _lowerCamelCase (					UpperCamelCase			):




       """simple docstring"""
       snake_case      =    "glpn"



       def __init__(      self				,       _SCREAMING_SNAKE_CASE=3				,       _SCREAMING_SNAKE_CASE=4				,       _SCREAMING_SNAKE_CASE=[2, 2, 2, 2]				,       _SCREAMING_SNAKE_CASE=[8, 4, 2, 1]				,       _SCREAMING_SNAKE_CASE=[32, 64, 160, 256]				,       _SCREAMING_SNAKE_CASE=[7, 3, 3, 3]				,       _SCREAMING_SNAKE_CASE=[4, 2, 2, 2]				,       _SCREAMING_SNAKE_CASE=[1, 2, 5, 8]				,       _SCREAMING_SNAKE_CASE=[4, 4, 4, 4]				,       _SCREAMING_SNAKE_CASE="gelu"				,       _SCREAMING_SNAKE_CASE=0.0				,       _SCREAMING_SNAKE_CASE=0.0				,       _SCREAMING_SNAKE_CASE=0.0_2				,       _SCREAMING_SNAKE_CASE=0.1				,       _SCREAMING_SNAKE_CASE=1e-6				,       _SCREAMING_SNAKE_CASE=64				,       _SCREAMING_SNAKE_CASE=10				,       _SCREAMING_SNAKE_CASE=-1				,       **_SCREAMING_SNAKE_CASE				,       )->Any:




         '''simple docstring'''





         super().__init__(**_SCREAMING_SNAKE_CASE		)

         A_      :				Optional[int]		     =					num_channels
         A_      :				Union[str, Any]		     =					num_encoder_blocks
         A_      :				int		     =					depths
         A_      :				Dict		     =					sr_ratios
         A_      :				Any		     =					hidden_sizes
         A_      :				int		     =					patch_sizes
         A_      :				Optional[int]		     =					strides
         A_      :				str		     =					mlp_ratios
         A_      :				List[str]		     =					num_attention_heads
         A_      :				str		     =					hidden_act
         A_      :				int		     =					hidden_dropout_prob
         A_      :				List[Any]		     =					attention_probs_dropout_prob
         A_      :				Optional[Any]		     =					initializer_range
         A_      :				Tuple		     =					drop_path_rate
         A_      :				Optional[int]		     =					layer_norm_eps
         A_      :				List[str]		     =					decoder_hidden_size
         A_      :				List[Any]		     =					max_depth
         A_      :				List[Any]		     =					head_in_index




