


"""simple docstring"""





import copy

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


snake_case__						:   Tuple			 = logging.get_logger(__name__)

snake_case__						:   Any			 = {
    '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.json''',
    # See all Deformable DETR models at https://huggingface.co/models?filter=deformable-detr
}



class 						snake_case_(				a__	):
     __UpperCamelCase     =    '''deformable_detr'''
     __UpperCamelCase     =    {
         '''hidden_size''': '''d_model''',
         '''num_attention_heads''': '''encoder_attention_heads''',
     }






     def __init__(		self     :    str    , UpperCamelCase_     :    Union[str, Any]=True    , UpperCamelCase_     :    Optional[int]=None    , UpperCamelCase_     :    List[Any]=3    , UpperCamelCase_     :    List[Any]=3_0_0    , UpperCamelCase_     :    int=1_0_2_4    , UpperCamelCase_     :    Any=6    , UpperCamelCase_     :    Optional[Any]=1_0_2_4    , UpperCamelCase_     :    Optional[Any]=8    , UpperCamelCase_     :    List[Any]=6    , UpperCamelCase_     :    Any=1_0_2_4    , UpperCamelCase_     :    List[str]=8    , UpperCamelCase_     :    int=0.0    , UpperCamelCase_     :    int=True    , UpperCamelCase_     :    Union[str, Any]="relu"    , UpperCamelCase_     :    int=2_5_6    , UpperCamelCase_     :    Optional[Any]=0.1    , UpperCamelCase_     :    List[str]=0.0    , UpperCamelCase_     :    List[Any]=0.0    , UpperCamelCase_     :    Optional[Any]=0.02    , UpperCamelCase_     :    List[Any]=1.0    , UpperCamelCase_     :    Optional[Any]=True    , UpperCamelCase_     :    List[Any]=False    , UpperCamelCase_     :    List[str]="sine"    , UpperCamelCase_     :    Union[str, Any]="resnet50"    , UpperCamelCase_     :    Union[str, Any]=True    , UpperCamelCase_     :    Union[str, Any]=False    , UpperCamelCase_     :    Optional[int]=4    , UpperCamelCase_     :    int=4    , UpperCamelCase_     :    List[str]=4    , UpperCamelCase_     :    Dict=False    , UpperCamelCase_     :    str=3_0_0    , UpperCamelCase_     :    List[str]=False    , UpperCamelCase_     :    Union[str, Any]=1    , UpperCamelCase_     :    Any=5    , UpperCamelCase_     :    Union[str, Any]=2    , UpperCamelCase_     :    Any=1    , UpperCamelCase_     :    Dict=1    , UpperCamelCase_     :    Any=5    , UpperCamelCase_     :    Tuple=2    , UpperCamelCase_     :    Union[str, Any]=0.1    , UpperCamelCase_     :    Any=0.25    , UpperCamelCase_     :    Optional[Any]=False    , **UpperCamelCase_     :    Tuple    , ):
           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.''' )
                       lowerCAmelCase    :		List[Any]				=      CONFIG_MAPPING['''resnet'''](out_features=['''stage4'''] )
                 elif isinstance(__a    , __a ):
                       lowerCAmelCase    :		List[str]				=      backbone_config.get('''model_type''' )
                       lowerCAmelCase    :		List[Any]				=      CONFIG_MAPPING[backbone_model_type]
                       lowerCAmelCase    :		Optional[int]				=      config_class.from_dict(__a )
           lowerCAmelCase    :		Optional[int]				=      use_timm_backbone
           lowerCAmelCase    :		Tuple				=      backbone_config
           lowerCAmelCase    :		Optional[Any]				=      num_channels
           lowerCAmelCase    :		Any				=      num_queries
           lowerCAmelCase    :		int				=      max_position_embeddings
           lowerCAmelCase    :		Optional[Any]				=      d_model
           lowerCAmelCase    :		Any				=      encoder_ffn_dim
           lowerCAmelCase    :		int				=      encoder_layers
           lowerCAmelCase    :		Union[str, Any]				=      encoder_attention_heads
           lowerCAmelCase    :		Union[str, Any]				=      decoder_ffn_dim
           lowerCAmelCase    :		int				=      decoder_layers
           lowerCAmelCase    :		str				=      decoder_attention_heads
           lowerCAmelCase    :		Optional[int]				=      dropout
           lowerCAmelCase    :		int				=      attention_dropout
           lowerCAmelCase    :		Dict				=      activation_dropout
           lowerCAmelCase    :		str				=      activation_function
           lowerCAmelCase    :		List[Any]				=      init_std
           lowerCAmelCase    :		List[Any]				=      init_xavier_std
           lowerCAmelCase    :		Union[str, Any]				=      encoder_layerdrop
           lowerCAmelCase    :		Optional[Any]				=      auxiliary_loss
           lowerCAmelCase    :		str				=      position_embedding_type
           lowerCAmelCase    :		Optional[int]				=      backbone
           lowerCAmelCase    :		Any				=      use_pretrained_backbone
           lowerCAmelCase    :		List[Any]				=      dilation
           # deformable attributes
           lowerCAmelCase    :		Tuple				=      num_feature_levels
           lowerCAmelCase    :		Union[str, Any]				=      encoder_n_points
           lowerCAmelCase    :		str				=      decoder_n_points
           lowerCAmelCase    :		Tuple				=      two_stage
           lowerCAmelCase    :		List[Any]				=      two_stage_num_proposals
           lowerCAmelCase    :		Any				=      with_box_refine
           if two_stage is True and with_box_refine is False:
                 raise ValueError('''If two_stage is True, with_box_refine must be True.''' )
           # Hungarian matcher
           lowerCAmelCase    :		List[str]				=      class_cost
           lowerCAmelCase    :		int				=      bbox_cost
           lowerCAmelCase    :		List[Any]				=      giou_cost
           # Loss coefficients
           lowerCAmelCase    :		Tuple				=      mask_loss_coefficient
           lowerCAmelCase    :		Tuple				=      dice_loss_coefficient
           lowerCAmelCase    :		List[Any]				=      bbox_loss_coefficient
           lowerCAmelCase    :		List[Any]				=      giou_loss_coefficient
           lowerCAmelCase    :		Optional[int]				=      eos_coefficient
           lowerCAmelCase    :		Any				=      focal_alpha
           lowerCAmelCase    :		List[Any]				=      disable_custom_kernels
           super().__init__(is_encoder_decoder=__a    , **__a )






     @property
     def    lowerCamelCase__   (		self     :    List[Any] ):
           return self.encoder_attention_heads






     @property
     def    lowerCamelCase__   (		self     :    Any ):
           return self.d_model






     def    lowerCamelCase__   (		self     :    Union[str, Any] ):
           lowerCAmelCase    :		List[Any]				=      copy.deepcopy(self.__dict__ )
           if self.backbone_config is not None:
                 lowerCAmelCase    :		List[str]				=      self.backbone_config.to_dict()
           lowerCAmelCase    :		Tuple				=      self.__class__.model_type
           return output




"""simple docstring"""





def       lowerCamelCase__		(			__snake_case	)							->		bool:


					"""simple docstring"""





					return credit_card_number.startswith(('''34''', '''35''', '''37''', '''4''', '''5''', '''6''')	)



def       lowerCamelCase__		(			__snake_case	)							->		bool:


					"""simple docstring"""





					_UpperCamelCase							 =  credit_card_number
					_UpperCamelCase							 =  0
					_UpperCamelCase							 =  len(__snake_case	) - 2
					for i in range(__snake_case,     -1,     -2	):
										#  double the value of every second digit
										_UpperCamelCase							 =  int(cc_number[i]	)
										digit *= 2
										# If doubling of a number results in a two digit number
										# i.e greater than 9(e.g., 6 × 2 = 12),
										# then add the digits of the product (e.g., 12: 1 + 2 = 3, 15: 1 + 5 = 6),
										# to get a single digit number.
										if digit > 9:
															digit %= 10
															digit += 1
										_UpperCamelCase							 =  cc_number[:i] + str(__snake_case	) + cc_number[i + 1 :]
										total += digit

					# Sum up the remaining digits
					for i in range(len(__snake_case	) - 1,     -1,     -2	):
										total += int(cc_number[i]	)

					return total % 10 == 0



def       lowerCamelCase__		(			__snake_case	)							->		bool:


					"""simple docstring"""





					_UpperCamelCase							 =  F'''{credit_card_number} is an invalid credit card number because'''
					if not credit_card_number.isdigit():
										print(F'''{error_message} it has nonnumerical characters.'''	)
										return False

					if not 13 <= len(__snake_case	) <= 16:
										print(F'''{error_message} of its length.'''	)
										return False

					if not validate_initial_digits(__snake_case	):
										print(F'''{error_message} of its first two digits.'''	)
										return False

					if not luhn_validation(__snake_case	):
										print(F'''{error_message} it fails the Luhn check.'''	)
										return False

					print(F'''{credit_card_number} is a valid credit card number.'''	)
					return True


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				validate_credit_card_number("""4111111111111111""")
				validate_credit_card_number("""32323""")






