

'''simple docstring'''
import inspect
import unittest

import numpy as np

from tests.test_modeling_common import floats_tensor
from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available
from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device
from transformers.utils import cached_property

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
     import torch

     from transformers import MaskFormerForInstanceSegmentation, MaskFormerModel

     if is_vision_available():
          from transformers import MaskFormerImageProcessor

if is_vision_available():
     from PIL import Image







class 							A__   :





  def __init__(		self				:     Any							, _a				:     List[Any]							, _a				:     Union[str, Any]=2							, _a				:     Any=True							, _a				:     List[Any]=False							, _a				:     Tuple=10							, _a				:     Any=3							, _a				:     int=32 * 4							, _a				:     Dict=32 * 6							, _a				:     Any=4							, _a				:     Any=32							, )     ->   Dict:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =parent
       _SCREAMING_SNAKE_CASE							   =batch_size
       _SCREAMING_SNAKE_CASE							   =is_training
       _SCREAMING_SNAKE_CASE							   =use_auxiliary_loss
       _SCREAMING_SNAKE_CASE							   =num_queries
       _SCREAMING_SNAKE_CASE							   =num_channels
       _SCREAMING_SNAKE_CASE							   =min_size
       _SCREAMING_SNAKE_CASE							   =max_size
       _SCREAMING_SNAKE_CASE							   =num_labels
       _SCREAMING_SNAKE_CASE							   =mask_feature_size





  def 						A  (		self				:     Optional[int]			)     ->   List[Any]:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =floats_tensor([self.batch_size, self.num_channels, self.min_size, self.max_size]			).to(
           _a			)

       _SCREAMING_SNAKE_CASE							   =torch.ones([self.batch_size, self.min_size, self.max_size]							, device=_a			)

       _SCREAMING_SNAKE_CASE							   =(
           torch.rand([self.batch_size, self.num_labels, self.min_size, self.max_size]							, device=_a			) > 0.5
       ).float()
       _SCREAMING_SNAKE_CASE							   =(torch.rand((self.batch_size, self.num_labels)							, device=_a			) > 0.5).long()

       _SCREAMING_SNAKE_CASE							   =self.get_config()
       return config, pixel_values, pixel_mask, mask_labels, class_labels





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





       '''simple docstring'''






       return MaskFormerConfig.from_backbone_and_decoder_configs(
           backbone_config=SwinConfig(
               depths=[1, 1, 1, 1]							, )							, decoder_config=DetrConfig(
               decoder_ffn_dim=128							, num_queries=self.num_queries							, decoder_attention_heads=2							, d_model=self.mask_feature_size							, )							, mask_feature_size=self.mask_feature_size							, fpn_feature_size=self.mask_feature_size							, num_channels=self.num_channels							, num_labels=self.num_labels							, )





  def 						A  (		self				:     Optional[Any]			)     ->   int:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE							   =self.prepare_config_and_inputs()
       _SCREAMING_SNAKE_CASE							   ={'pixel_values': pixel_values, 'pixel_mask': pixel_mask}
       return config, inputs_dict





  def 						A  (		self				:     str							, _a				:     Any							, _a				:     Tuple			)     ->   Dict:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =output.encoder_hidden_states
       _SCREAMING_SNAKE_CASE							   =output.pixel_decoder_hidden_states
       _SCREAMING_SNAKE_CASE							   =output.transformer_decoder_hidden_states

       self.parent.assertTrue(len(_a			)							, len(config.backbone_config.depths			)			)
       self.parent.assertTrue(len(_a			)							, len(config.backbone_config.depths			)			)
       self.parent.assertTrue(len(_a			)							, config.decoder_config.decoder_layers			)





  def 						A  (		self				:     Any							, _a				:     List[Any]							, _a				:     List[str]							, _a				:     List[Any]							, _a				:     List[Any]=False			)     ->   Optional[Any]:





       '''simple docstring'''






       with torch.no_grad():
            _SCREAMING_SNAKE_CASE							   =MaskFormerModel(config=_a			)
            model.to(_a			)
            model.eval()

            _SCREAMING_SNAKE_CASE							   =model(pixel_values=_a							, pixel_mask=_a			)
            _SCREAMING_SNAKE_CASE							   =model(_a							, output_hidden_states=_a			)
       # the correct shape of output.transformer_decoder_hidden_states ensure the correcteness of the
       # encoder and pixel decoder
       self.parent.assertEqual(
           output.transformer_decoder_last_hidden_state.shape							, (self.batch_size, self.num_queries, self.mask_feature_size)							, )
       # let's ensure the other two hidden state exists
       self.parent.assertTrue(output.pixel_decoder_last_hidden_state is not None			)
       self.parent.assertTrue(output.encoder_last_hidden_state is not None			)

       if output_hidden_states:
            self.check_output_hidden_state(_a							, _a			)





  def 						A  (		self				:     int							, _a				:     Dict							, _a				:     Tuple							, _a				:     List[Any]							, _a				:     List[Any]							, _a				:     Optional[int]			)     ->   List[Any]:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =MaskFormerForInstanceSegmentation(config=_a			)
       model.to(_a			)
       model.eval()

       def comm_check_on_output(_a				:     Tuple			):
            # let's still check that all the required stuff is there
            self.parent.assertTrue(result.transformer_decoder_last_hidden_state is not None			)
            self.parent.assertTrue(result.pixel_decoder_last_hidden_state is not None			)
            self.parent.assertTrue(result.encoder_last_hidden_state is not None			)
            # okay, now we need to check the logits shape
            # due to the encoder compression, masks have a //4 spatial size
            self.parent.assertEqual(
                result.masks_queries_logits.shape							, (self.batch_size, self.num_queries, self.min_size // 4, self.max_size // 4)							, )
            # + 1 for null class
            self.parent.assertEqual(
                result.class_queries_logits.shape							, (self.batch_size, self.num_queries, self.num_labels + 1)			)

       with torch.no_grad():
            _SCREAMING_SNAKE_CASE							   =model(pixel_values=_a							, pixel_mask=_a			)
            _SCREAMING_SNAKE_CASE							   =model(_a			)

            comm_check_on_output(_a			)

            _SCREAMING_SNAKE_CASE							   =model(
                pixel_values=_a							, pixel_mask=_a							, mask_labels=_a							, class_labels=_a			)

       comm_check_on_output(_a			)

       self.parent.assertTrue(result.loss is not None			)
       self.parent.assertEqual(result.loss.shape							, torch.Size([1]			)			)







@require_torch
class 							A__   (	A__					,       A__					,       unittest.TestCase  ):
  A__					=    (MaskFormerModel, MaskFormerForInstanceSegmentation) if is_torch_available() else ()
  A__					=    (
      {'feature-extraction': MaskFormerModel, 'image-segmentation': MaskFormerForInstanceSegmentation}
      if is_torch_available()
      else {}
  )

  A__					=    False
  A__					=    False
  A__					=    False
  A__					=    False





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





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =MaskFormerModelTester(self			)
       _SCREAMING_SNAKE_CASE							   =ConfigTester(self							, config_class=_a							, has_text_modality=_a			)





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





       '''simple docstring'''






       self.config_tester.run_common_tests()





  def 						A  (		self				:     Union[str, Any]			)     ->   Optional[int]:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE							   =self.model_tester.prepare_config_and_inputs_for_common()
       self.model_tester.create_and_check_maskformer_model(_a							, **_a							, output_hidden_states=_a			)





  def 						A  (		self				:     Tuple			)     ->   Tuple:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_maskformer_instance_segmentation_head_model(*_a			)





  @unittest.skip(reason='MaskFormer does not use inputs_embeds'			)
  def 						A  (		self				:     Any			)     ->   Optional[int]:





       '''simple docstring'''






       pass





  @unittest.skip(reason='MaskFormer does not have a get_input_embeddings method'			)
  def 						A  (		self				:     List[Any]			)     ->   Any:





       '''simple docstring'''






       pass





  @unittest.skip(reason='MaskFormer is not a generative model'			)
  def 						A  (		self				:     Optional[Any]			)     ->   List[Any]:





       '''simple docstring'''






       pass





  @unittest.skip(reason='MaskFormer does not use token embeddings'			)
  def 						A  (		self				:     List[Any]			)     ->   List[str]:





       '''simple docstring'''






       pass





  @require_torch_multi_gpu
  @unittest.skip(
      reason='MaskFormer has some layers using `add_module` which doesn\'t work well with `nn.DataParallel`'			)
  def 						A  (		self				:     List[Any]			)     ->   Optional[Any]:





       '''simple docstring'''






       pass





  @unittest.skip('Will be fixed soon by reducing the size of the model used for common tests.'			)
  def 						A  (		self				:     List[Any]			)     ->   Optional[Any]:





       '''simple docstring'''






       pass





  def 						A  (		self				:     Optional[int]			)     ->   List[Any]:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE							   =self.model_tester.prepare_config_and_inputs_for_common()

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

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





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





       '''simple docstring'''






       for model_name in ["facebook/maskformer-swin-small-coco"]:
            _SCREAMING_SNAKE_CASE							   =MaskFormerModel.from_pretrained(_a			)
            self.assertIsNotNone(_a			)





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





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =(self.model_tester.min_size,) * 2
       _SCREAMING_SNAKE_CASE							   ={
           'pixel_values': torch.randn((2, 3, *size)							, device=_a			),
           'mask_labels': torch.randn((2, 10, *size)							, device=_a			),
           'class_labels': torch.zeros(2							, 10							, device=_a			).long(),
       }

       _SCREAMING_SNAKE_CASE							   =MaskFormerForInstanceSegmentation(MaskFormerConfig()			).to(_a			)
       _SCREAMING_SNAKE_CASE							   =model(**_a			)
       self.assertTrue(outputs.loss is not None			)





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





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE							   =self.model_tester.prepare_config_and_inputs_for_common()
       self.model_tester.create_and_check_maskformer_model(_a							, **_a							, output_hidden_states=_a			)





  def 						A  (		self				:     List[Any]			)     ->   Dict:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE							   =self.model_tester.prepare_config_and_inputs_for_common()

       for model_class in self.all_model_classes:
            _SCREAMING_SNAKE_CASE							   =model_class(_a			).to(_a			)
            _SCREAMING_SNAKE_CASE							   =model(**_a							, output_attentions=_a			)
            self.assertTrue(outputs.attentions is not None			)





  def 						A  (		self				:     Dict			)     ->   List[str]:





       '''simple docstring'''






       if not self.model_tester.is_training:
            return
       # only MaskFormerForInstanceSegmentation has the loss
       _SCREAMING_SNAKE_CASE							   =self.all_model_classes[1]
       _SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE							   =self.model_tester.prepare_config_and_inputs()

       _SCREAMING_SNAKE_CASE							   =model_class(_a			)
       model.to(_a			)
       model.train()

       _SCREAMING_SNAKE_CASE							   =model(_a							, mask_labels=_a							, class_labels=_a			).loss
       loss.backward()





  def 						A  (		self				:     Tuple			)     ->   Optional[Any]:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =self.all_model_classes[1]
       _SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE							   =self.model_tester.prepare_config_and_inputs()
       _SCREAMING_SNAKE_CASE							   =True
       _SCREAMING_SNAKE_CASE							   =True

       _SCREAMING_SNAKE_CASE							   =model_class(_a			)
       model.to(_a			)
       model.train()

       _SCREAMING_SNAKE_CASE							   =model(_a							, mask_labels=_a							, class_labels=_a			)

       _SCREAMING_SNAKE_CASE							   =outputs.encoder_hidden_states[0]
       encoder_hidden_states.retain_grad()

       _SCREAMING_SNAKE_CASE							   =outputs.pixel_decoder_hidden_states[0]
       pixel_decoder_hidden_states.retain_grad()
       # we requires_grad=True in inputs_embeds (line 2152), the original implementation don't
       _SCREAMING_SNAKE_CASE							   =outputs.transformer_decoder_hidden_states[0]
       transformer_decoder_hidden_states.retain_grad()

       _SCREAMING_SNAKE_CASE							   =outputs.attentions[0]
       attentions.retain_grad()

       outputs.loss.backward(retain_graph=_a			)

       self.assertIsNotNone(encoder_hidden_states.grad			)
       self.assertIsNotNone(pixel_decoder_hidden_states.grad			)
       self.assertIsNotNone(transformer_decoder_hidden_states.grad			)
       self.assertIsNotNone(attentions.grad			)

lowerCamelCase			:				Optional[int] 			=					1E-4


def 	_lowerCAmelCase (						)				->      List[Any]:
     """simple docstring"""




     _SCREAMING_SNAKE_CASE							   =Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'    )
     return image







@require_vision
@slow
class 							A__   (	unittest.TestCase  ):





  @cached_property
  def 						A  (		self				:     Optional[Any]			)     ->   Optional[Any]:





       '''simple docstring'''






       return (
           MaskFormerImageProcessor.from_pretrained('facebook/maskformer-swin-small-coco'			)
           if is_vision_available()
           else None
       )





  def 						A  (		self				:     Dict			)     ->   List[Any]:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =MaskFormerModel.from_pretrained('facebook/maskformer-swin-small-coco'			).to(_a			)
       _SCREAMING_SNAKE_CASE							   =self.default_image_processor
       _SCREAMING_SNAKE_CASE							   =prepare_img()
       _SCREAMING_SNAKE_CASE							   =image_processor(_a							, return_tensors='pt'			).to(_a			)
       _SCREAMING_SNAKE_CASE							   =inputs['pixel_values'].shape
       # check size is divisible by 32
       self.assertTrue((inputs_shape[-1] % 32) == 0 and (inputs_shape[-2] % 32) == 0			)
       # check size
       self.assertEqual(_a							, (1, 3, 800, 1088)			)

       with torch.no_grad():
            _SCREAMING_SNAKE_CASE							   =model(**_a			)

       _SCREAMING_SNAKE_CASE							   =torch.tensor(
           [[-0.04_82, 0.92_28, 0.49_51], [-0.25_47, 0.80_17, 0.85_27], [-0.00_69, 0.33_85, -0.00_89]]			).to(_a			)
       self.assertTrue(
           torch.allclose(
               outputs.encoder_last_hidden_state[0, 0, :3, :3]							, _a							, atol=_a			)			)

       _SCREAMING_SNAKE_CASE							   =torch.tensor(
           [[-0.84_22, -0.84_34, -0.97_18], [-1.01_44, -0.55_65, -0.41_95], [-1.00_38, -0.44_84, -0.19_61]]			).to(_a			)
       self.assertTrue(
           torch.allclose(
               outputs.pixel_decoder_last_hidden_state[0, 0, :3, :3]							, _a							, atol=_a			)			)

       _SCREAMING_SNAKE_CASE							   =torch.tensor(
           [[0.28_52, -0.01_59, 0.97_35], [0.62_54, 0.18_58, 0.85_29], [-0.06_80, -0.41_16, 1.84_13]]			).to(_a			)
       self.assertTrue(
           torch.allclose(
               outputs.transformer_decoder_last_hidden_state[0, :3, :3]							, _a							, atol=_a			)			)





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





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =(
           MaskFormerForInstanceSegmentation.from_pretrained('facebook/maskformer-swin-small-coco'			)
           .to(_a			)
           .eval()
       )
       _SCREAMING_SNAKE_CASE							   =self.default_image_processor
       _SCREAMING_SNAKE_CASE							   =prepare_img()
       _SCREAMING_SNAKE_CASE							   =image_processor(_a							, return_tensors='pt'			).to(_a			)
       _SCREAMING_SNAKE_CASE							   =inputs['pixel_values'].shape
       # check size is divisible by 32
       self.assertTrue((inputs_shape[-1] % 32) == 0 and (inputs_shape[-2] % 32) == 0			)
       # check size
       self.assertEqual(_a							, (1, 3, 800, 1088)			)

       with torch.no_grad():
            _SCREAMING_SNAKE_CASE							   =model(**_a			)
       # masks_queries_logits
       _SCREAMING_SNAKE_CASE							   =outputs.masks_queries_logits
       self.assertEqual(
           masks_queries_logits.shape							, (1, model.config.decoder_config.num_queries, inputs_shape[-2] // 4, inputs_shape[-1] // 4)							, )
       _SCREAMING_SNAKE_CASE							   =[
           [-1.3_73_71_24, -1.7_72_49_37, -1.9_36_42_33],
           [-1.5_97_72_81, -1.9_86_79_39, -2.1_52_36_95],
           [-1.5_79_53_98, -1.9_26_98_32, -2.09_39_42],
       ]
       _SCREAMING_SNAKE_CASE							   =torch.tensor(_a			).to(_a			)
       self.assertTrue(torch.allclose(masks_queries_logits[0, 0, :3, :3]							, _a							, atol=_a			)			)
       # class_queries_logits
       _SCREAMING_SNAKE_CASE							   =outputs.class_queries_logits
       self.assertEqual(
           class_queries_logits.shape							, (1, model.config.decoder_config.num_queries, model.config.num_labels + 1)			)
       _SCREAMING_SNAKE_CASE							   =torch.tensor(
           [
               [1.6_512e00, -5.2_572e00, -3.3_519e00],
               [3.6_169e-02, -5.9_025e00, -2.9_313e00],
               [1.0_766e-04, -7.7_630e00, -5.1_263e00],
           ]			).to(_a			)
       self.assertTrue(torch.allclose(outputs.class_queries_logits[0, :3, :3]							, _a							, atol=_a			)			)





  def 						A  (		self				:     Any			)     ->   int:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =(
           MaskFormerForInstanceSegmentation.from_pretrained('facebook/maskformer-resnet101-coco-stuff'			)
           .to(_a			)
           .eval()
       )
       _SCREAMING_SNAKE_CASE							   =self.default_image_processor
       _SCREAMING_SNAKE_CASE							   =prepare_img()
       _SCREAMING_SNAKE_CASE							   =image_processor(_a							, return_tensors='pt'			).to(_a			)
       _SCREAMING_SNAKE_CASE							   =inputs['pixel_values'].shape
       # check size is divisible by 32
       self.assertTrue((inputs_shape[-1] % 32) == 0 and (inputs_shape[-2] % 32) == 0			)
       # check size
       self.assertEqual(_a							, (1, 3, 800, 1088)			)

       with torch.no_grad():
            _SCREAMING_SNAKE_CASE							   =model(**_a			)
       # masks_queries_logits
       _SCREAMING_SNAKE_CASE							   =outputs.masks_queries_logits
       self.assertEqual(
           masks_queries_logits.shape							, (1, model.config.decoder_config.num_queries, inputs_shape[-2] // 4, inputs_shape[-1] // 4)							, )
       _SCREAMING_SNAKE_CASE							   =[[-0.90_46, -2.63_66, -4.60_62], [-3.41_79, -5.78_90, -8.80_57], [-4.91_79, -7.65_60, -10.77_11]]
       _SCREAMING_SNAKE_CASE							   =torch.tensor(_a			).to(_a			)
       self.assertTrue(torch.allclose(masks_queries_logits[0, 0, :3, :3]							, _a							, atol=_a			)			)
       # class_queries_logits
       _SCREAMING_SNAKE_CASE							   =outputs.class_queries_logits
       self.assertEqual(
           class_queries_logits.shape							, (1, model.config.decoder_config.num_queries, model.config.num_labels + 1)			)
       _SCREAMING_SNAKE_CASE							   =torch.tensor(
           [[4.71_88, -3.25_85, -2.88_57], [6.68_71, -2.91_81, -1.24_87], [7.24_49, -2.27_64, -2.18_74]]			).to(_a			)
       self.assertTrue(torch.allclose(outputs.class_queries_logits[0, :3, :3]							, _a							, atol=_a			)			)





  def 						A  (		self				:     Dict			)     ->   Dict:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =(
           MaskFormerForInstanceSegmentation.from_pretrained('facebook/maskformer-swin-small-coco'			)
           .to(_a			)
           .eval()
       )
       _SCREAMING_SNAKE_CASE							   =self.default_image_processor

       _SCREAMING_SNAKE_CASE							   =image_processor(
           [np.zeros((3, 800, 1333)			), np.zeros((3, 800, 1333)			)]							, segmentation_maps=[np.zeros((384, 384)			).astype(np.floataa			), np.zeros((384, 384)			).astype(np.floataa			)]							, return_tensors='pt'							, )

       _SCREAMING_SNAKE_CASE							   =inputs['pixel_values'].to(_a			)
       _SCREAMING_SNAKE_CASE							   =[el.to(_a			) for el in inputs['mask_labels']]
       _SCREAMING_SNAKE_CASE							   =[el.to(_a			) for el in inputs['class_labels']]

       with torch.no_grad():
            _SCREAMING_SNAKE_CASE							   =model(**_a			)

       self.assertTrue(outputs.loss is not None			)



'''simple docstring'''
from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowerCamelCase			:				Any 			=					logging.get_logger(__name__)

lowerCamelCase			:				int 			=					{
    "facebook/data2vec-vision-base-ft": (
        "https://huggingface.co/facebook/data2vec-vision-base-ft/resolve/main/config.json"
    ),
}







class 							A__   (	A__  ):
  A__					=    'data2vec-vision'





  def __init__(		self				:     str							, _a				:     Optional[int]=768							, _a				:     List[str]=12							, _a				:     Any=12							, _a				:     Tuple=3072							, _a				:     Optional[Any]="gelu"							, _a				:     Tuple=0.0							, _a				:     str=0.0							, _a				:     Dict=0.02							, _a				:     int=1e-12							, _a				:     List[str]=224							, _a				:     str=16							, _a				:     Dict=3							, _a				:     int=False							, _a				:     List[str]=False							, _a				:     str=False							, _a				:     str=False							, _a				:     Optional[int]=0.1							, _a				:     List[str]=0.1							, _a				:     Dict=True							, _a				:     str=[3, 5, 7, 11]							, _a				:     List[Any]=[1, 2, 3, 6]							, _a				:     Any=True							, _a				:     Optional[Any]=0.4							, _a				:     str=256							, _a				:     Dict=1							, _a				:     List[str]=False							, _a				:     List[Any]=255							, **_a				:     Any							, )     ->   Optional[Any]:





       '''simple docstring'''






       super().__init__(**_a			)

       _SCREAMING_SNAKE_CASE							   =hidden_size
       _SCREAMING_SNAKE_CASE							   =num_hidden_layers
       _SCREAMING_SNAKE_CASE							   =num_attention_heads
       _SCREAMING_SNAKE_CASE							   =intermediate_size
       _SCREAMING_SNAKE_CASE							   =hidden_act
       _SCREAMING_SNAKE_CASE							   =hidden_dropout_prob
       _SCREAMING_SNAKE_CASE							   =attention_probs_dropout_prob
       _SCREAMING_SNAKE_CASE							   =initializer_range
       _SCREAMING_SNAKE_CASE							   =layer_norm_eps

       _SCREAMING_SNAKE_CASE							   =image_size
       _SCREAMING_SNAKE_CASE							   =patch_size
       _SCREAMING_SNAKE_CASE							   =num_channels
       _SCREAMING_SNAKE_CASE							   =use_mask_token
       _SCREAMING_SNAKE_CASE							   =use_absolute_position_embeddings
       _SCREAMING_SNAKE_CASE							   =use_relative_position_bias
       _SCREAMING_SNAKE_CASE							   =use_shared_relative_position_bias
       _SCREAMING_SNAKE_CASE							   =layer_scale_init_value
       _SCREAMING_SNAKE_CASE							   =drop_path_rate
       _SCREAMING_SNAKE_CASE							   =use_mean_pooling
       # decode head attributes (semantic segmentation)
       _SCREAMING_SNAKE_CASE							   =out_indices
       _SCREAMING_SNAKE_CASE							   =pool_scales
       # auxiliary head attributes (semantic segmentation)
       _SCREAMING_SNAKE_CASE							   =use_auxiliary_head
       _SCREAMING_SNAKE_CASE							   =auxiliary_loss_weight
       _SCREAMING_SNAKE_CASE							   =auxiliary_channels
       _SCREAMING_SNAKE_CASE							   =auxiliary_num_convs
       _SCREAMING_SNAKE_CASE							   =auxiliary_concat_input
       _SCREAMING_SNAKE_CASE							   =semantic_loss_ignore_index







class 							A__   (	A__  ):
  A__					=    version.parse('1.11'  )





  @property
  def 						A  (		self				:     str			)     ->   Mapping[str, Mapping[int, str]]:





       '''simple docstring'''






       return OrderedDict(
           [
               ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
           ]			)





  @property
  def 						A  (		self				:     List[Any]			)     ->   float:





       '''simple docstring'''






       return 1e-4
