






"""simple docstring"""







import copy
from collections import OrderedDict
from typing import Dict, Mapping

from packaging import version

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


_UpperCamelCase					      =  logging.get_logger(__name__)

_UpperCamelCase					      =  {
    '''facebook/detr-resnet-50''': '''https://huggingface.co/facebook/detr-resnet-50/resolve/main/config.json''',
    # See all DETR models at https://huggingface.co/models?filter=detr
}







class  lowerCamelCase__ (	A__			):
    SCREAMING_SNAKE_CASE		=      'detr'
    SCREAMING_SNAKE_CASE		=      ['past_key_values']
    SCREAMING_SNAKE_CASE		=      {
        'hidden_size': 'd_model',
        'num_attention_heads': 'encoder_attention_heads',
    }






    def __init__(			self     ,A=True     ,A=None     ,A=3     ,A=100     ,A=6     ,A=2_048     ,A=8     ,A=6     ,A=2_048     ,A=8     ,A=0.0     ,A=0.0     ,A=True     ,A="relu"     ,A=256     ,A=0.1     ,A=0.0     ,A=0.0     ,A=0.02     ,A=1.0     ,A=False     ,A="sine"     ,A="resnet50"     ,A=True     ,A=False     ,A=1     ,A=5     ,A=2     ,A=1     ,A=1     ,A=5     ,A=2     ,A=0.1     ,**A     ,):
          if backbone_config is not None and use_timm_backbone:
                raise ValueError("""You can\'t specify both `backbone_config` and `use_timm_backbone`.""" )

          if not use_timm_backbone:
                if backbone_config is None:
                      logger.info("""`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.""" )
                      UpperCAmelCase          =	CONFIG_MAPPING["""resnet"""](out_features=["""stage4"""] )
                elif isinstance(lowerCamelCase__     ,lowerCamelCase__ ):
                      UpperCAmelCase          =	backbone_config.get("""model_type""" )
                      UpperCAmelCase          =	CONFIG_MAPPING[backbone_model_type]
                      UpperCAmelCase          =	config_class.from_dict(lowerCamelCase__ )
                # set timm attributes to None
                UpperCAmelCase      , UpperCAmelCase      , UpperCAmelCase          =	None, None, None

          UpperCAmelCase          =	use_timm_backbone
          UpperCAmelCase          =	backbone_config
          UpperCAmelCase          =	num_channels
          UpperCAmelCase          =	num_queries
          UpperCAmelCase          =	d_model
          UpperCAmelCase          =	encoder_ffn_dim
          UpperCAmelCase          =	encoder_layers
          UpperCAmelCase          =	encoder_attention_heads
          UpperCAmelCase          =	decoder_ffn_dim
          UpperCAmelCase          =	decoder_layers
          UpperCAmelCase          =	decoder_attention_heads
          UpperCAmelCase          =	dropout
          UpperCAmelCase          =	attention_dropout
          UpperCAmelCase          =	activation_dropout
          UpperCAmelCase          =	activation_function
          UpperCAmelCase          =	init_std
          UpperCAmelCase          =	init_xavier_std
          UpperCAmelCase          =	encoder_layerdrop
          UpperCAmelCase          =	decoder_layerdrop
          UpperCAmelCase          =	encoder_layers
          UpperCAmelCase          =	auxiliary_loss
          UpperCAmelCase          =	position_embedding_type
          UpperCAmelCase          =	backbone
          UpperCAmelCase          =	use_pretrained_backbone
          UpperCAmelCase          =	dilation
          # Hungarian matcher
          UpperCAmelCase          =	class_cost
          UpperCAmelCase          =	bbox_cost
          UpperCAmelCase          =	giou_cost
          # Loss coefficients
          UpperCAmelCase          =	mask_loss_coefficient
          UpperCAmelCase          =	dice_loss_coefficient
          UpperCAmelCase          =	bbox_loss_coefficient
          UpperCAmelCase          =	giou_loss_coefficient
          UpperCAmelCase          =	eos_coefficient
          super().__init__(is_encoder_decoder=lowerCamelCase__     ,**lowerCamelCase__ )






    @property
    def     _UpperCamelCase							(			self ):
          return self.encoder_attention_heads






    @property
    def     _UpperCamelCase							(			self ):
          return self.d_model






    @classmethod
    def     _UpperCamelCase							(			cls     ,A     ,**A ):
          return cls(backbone_config=lowerCamelCase__     ,**lowerCamelCase__ )






    def     _UpperCamelCase							(			self ):
          UpperCAmelCase          =	copy.deepcopy(self.__dict__ )
          if output["backbone_config"] is not None:
                UpperCAmelCase          =	self.backbone_config.to_dict()
          UpperCAmelCase          =	self.__class__.model_type
          return output







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






    @property
    def     _UpperCamelCase							(			self ):
          return OrderedDict(
              [
                  ("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""}),
                  ("""pixel_mask""", {0: """batch"""}),
              ] )






    @property
    def     _UpperCamelCase							(			self ):
          return 1e-5






    @property
    def     _UpperCamelCase							(			self ):
          return 12











"""simple docstring"""







_UpperCamelCase					      =  [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
_UpperCamelCase					      =  [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
_UpperCamelCase					      =  {
    0: """Sunday""",
    1: """Monday""",
    2: """Tuesday""",
    3: """Wednesday""",
    4: """Thursday""",
    5: """Friday""",
    6: """Saturday""",
}

def _a			(		_snake_case				,	_snake_case				,	_snake_case							):







      """simple docstring"""






      assert len(str(_snake_case							)							) > 2, "year should be in YYYY format"
      assert 1 <= month <= 12, "month should be between 1 to 12"
      assert 1 <= day <= 31, "day should be between 1 to 31"

      # Doomsday algorithm:
      UpperCAmelCase          =	year // 100
      UpperCAmelCase          =	(5 * (century % 4) + 2) % 7
      UpperCAmelCase          =	year % 100
      UpperCAmelCase          =	centurian % 12
      UpperCAmelCase          =	(
          (centurian // 12) + centurian_m + (centurian_m // 4) + century_anchor
      ) % 7
      UpperCAmelCase          =	(
          DOOMSDAY_NOT_LEAP[month - 1]
          if (year % 4 != 0) or (centurian == 0 and (year % 400) == 0)
          else DOOMSDAY_LEAP[month - 1]
      )
      UpperCAmelCase          =	(dooms_day + day - day_anchor) % 7
      return WEEK_DAY_NAMES[week_day]


if __name__ == "__main__":
  import doctest

  doctest.testmod()



