



import copy

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


__snake_case		:int   	=  logging.get_logger(__name__)

__snake_case		:Union[str, Any]   	=  {
    '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json''',
}

class 					_A (			__UpperCAmelCase					):
       UpperCamelCase__						:					Optional[int]		      =		'''deta'''
       UpperCamelCase__						:					Any		      =		{
           '''hidden_size''': '''d_model''',
           '''num_attention_heads''': '''encoder_attention_heads''',
       }



       def __init__(	self							:  str  ,	__SCREAMING_SNAKE_CASE							:  str=None  ,	__SCREAMING_SNAKE_CASE							:  str=900  ,	__SCREAMING_SNAKE_CASE							:  Union[str, Any]=2_048  ,	__SCREAMING_SNAKE_CASE							:  Optional[Any]=6  ,	__SCREAMING_SNAKE_CASE							:  Optional[Any]=2_048  ,	__SCREAMING_SNAKE_CASE							:  Any=8  ,	__SCREAMING_SNAKE_CASE							:  Dict=6  ,	__SCREAMING_SNAKE_CASE							:  List[Any]=1_024  ,	__SCREAMING_SNAKE_CASE							:  List[Any]=8  ,	__SCREAMING_SNAKE_CASE							:  List[str]=0.0  ,	__SCREAMING_SNAKE_CASE							:  Dict=True  ,	__SCREAMING_SNAKE_CASE							:  int="relu"  ,	__SCREAMING_SNAKE_CASE							:  Dict=256  ,	__SCREAMING_SNAKE_CASE							:  int=0.1  ,	__SCREAMING_SNAKE_CASE							:  Optional[int]=0.0  ,	__SCREAMING_SNAKE_CASE							:  Any=0.0  ,	__SCREAMING_SNAKE_CASE							:  Optional[int]=0.02  ,	__SCREAMING_SNAKE_CASE							:  List[str]=1.0  ,	__SCREAMING_SNAKE_CASE							:  str=True  ,	__SCREAMING_SNAKE_CASE							:  List[str]=False  ,	__SCREAMING_SNAKE_CASE							:  Tuple="sine"  ,	__SCREAMING_SNAKE_CASE							:  List[str]=5  ,	__SCREAMING_SNAKE_CASE							:  Union[str, Any]=4  ,	__SCREAMING_SNAKE_CASE							:  List[str]=4  ,	__SCREAMING_SNAKE_CASE							:  Optional[Any]=True  ,	__SCREAMING_SNAKE_CASE							:  List[str]=300  ,	__SCREAMING_SNAKE_CASE							:  str=True  ,	__SCREAMING_SNAKE_CASE							:  List[str]=True  ,	__SCREAMING_SNAKE_CASE							:  Any=1  ,	__SCREAMING_SNAKE_CASE							:  Any=5  ,	__SCREAMING_SNAKE_CASE							:  List[str]=2  ,	__SCREAMING_SNAKE_CASE							:  Dict=1  ,	__SCREAMING_SNAKE_CASE							:  str=1  ,	__SCREAMING_SNAKE_CASE							:  Dict=5  ,	__SCREAMING_SNAKE_CASE							:  int=2  ,	__SCREAMING_SNAKE_CASE							:  List[str]=0.1  ,	__SCREAMING_SNAKE_CASE							:  int=0.25  ,	**__SCREAMING_SNAKE_CASE							:  Dict  ,	):


           '''simple docstring'''

           if backbone_config is None:
               logger.info('''`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.''')
               __a		 =       CONFIG_MAPPING['''resnet'''](out_features=['''stage2''', '''stage3''', '''stage4'''])
           else:
               if isinstance(__SCREAMING_SNAKE_CASE  ,	__SCREAMING_SNAKE_CASE):
                   __a		 =       backbone_config.pop('''model_type''')
                   __a		 =       CONFIG_MAPPING[backbone_model_type]
                   __a		 =       config_class.from_dict(__SCREAMING_SNAKE_CASE)

           __a		 =       backbone_config
           __a		 =       num_queries
           __a		 =       max_position_embeddings
           __a		 =       d_model
           __a		 =       encoder_ffn_dim
           __a		 =       encoder_layers
           __a		 =       encoder_attention_heads
           __a		 =       decoder_ffn_dim
           __a		 =       decoder_layers
           __a		 =       decoder_attention_heads
           __a		 =       dropout
           __a		 =       attention_dropout
           __a		 =       activation_dropout
           __a		 =       activation_function
           __a		 =       init_std
           __a		 =       init_xavier_std
           __a		 =       encoder_layerdrop
           __a		 =       auxiliary_loss
           __a		 =       position_embedding_type
           # deformable attributes
           __a		 =       num_feature_levels
           __a		 =       encoder_n_points
           __a		 =       decoder_n_points
           __a		 =       two_stage
           __a		 =       two_stage_num_proposals
           __a		 =       with_box_refine
           __a		 =       assign_first_stage
           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
           __a		 =       class_cost
           __a		 =       bbox_cost
           __a		 =       giou_cost
           # Loss coefficients
           __a		 =       mask_loss_coefficient
           __a		 =       dice_loss_coefficient
           __a		 =       bbox_loss_coefficient
           __a		 =       giou_loss_coefficient
           __a		 =       eos_coefficient
           __a		 =       focal_alpha
           super().__init__(is_encoder_decoder=__SCREAMING_SNAKE_CASE  ,	**__SCREAMING_SNAKE_CASE)



       @property
       def 	_lowerCamelCase    (	self							:  Any):


           '''simple docstring'''

           return self.encoder_attention_heads



       @property
       def 	_lowerCamelCase    (	self							:  Any):


           '''simple docstring'''

           return self.d_model





       def 	_lowerCamelCase    (	self							:  Any):


           '''simple docstring'''

           __a		 =       copy.deepcopy(self.__dict__)
           __a		 =       self.backbone_config.to_dict()
           __a		 =       self.__class__.model_type
           return output










from collections.abc import Generator
from math import sin





def   __snake_case			(    _UpperCAmelCase       ):
    if len(_UpperCAmelCase       ) != 32:
        raise ValueError('''Input must be of length 32'''       )

    __a		 =       b''''''
    for i in [3, 2, 1, 0]:
        little_endian += string_aa[8 * i : 8 * i + 8]
    return little_endian





def   __snake_case			(    _UpperCAmelCase       ):
    if i < 0:
        raise ValueError('''Input must be non-negative'''       )

    __a		 =       format(_UpperCAmelCase     ,				'''08x'''       )[-8:]
    __a		 =       b''''''
    for i in [3, 2, 1, 0]:
        little_endian_hex += hex_rep[2 * i : 2 * i + 2].encode('''utf-8'''       )
    return little_endian_hex





def   __snake_case			(    _UpperCAmelCase       ):
    __a		 =       b''''''
    for char in message:
        bit_string += format(_UpperCAmelCase     ,				'''08b'''       ).encode('''utf-8'''       )
    __a		 =       format(len(_UpperCAmelCase       )     ,				'''064b'''       ).encode('''utf-8'''       )

    # Pad bit_string to a multiple of 512 chars
    bit_string += b"1"
    while len(_UpperCAmelCase       ) % 512 != 448:
        bit_string += b"0"
    bit_string += to_little_endian(start_len[32:]       ) + to_little_endian(start_len[:32]       )

    return bit_string





def   __snake_case			(    _UpperCAmelCase       ):
    if len(_UpperCAmelCase       ) % 512 != 0:
        raise ValueError('''Input must have length that\'s a multiple of 512'''       )

    for pos in range(0     ,				len(_UpperCAmelCase       )     ,				512       ):
        __a		 =       bit_string[pos : pos + 512]
        __a		 =       []
        for i in range(0     ,				512     ,				32       ):
            block_words.append(int(to_little_endian(block[i : i + 32]       )     ,				2       )       )
        yield block_words





def   __snake_case			(    _UpperCAmelCase       ):
    if i < 0:
        raise ValueError('''Input must be non-negative'''       )

    __a		 =       format(_UpperCAmelCase     ,				'''032b'''       )
    __a		 =       ''''''
    for c in i_str:
        new_str += "1" if c == "0" else "0"
    return int(_UpperCAmelCase     ,				2       )





def   __snake_case			(    _UpperCAmelCase     ,				_UpperCAmelCase       ):
    return (a + b) % 2**32





def   __snake_case			(    _UpperCAmelCase     ,				_UpperCAmelCase       ):
    if i < 0:
        raise ValueError('''Input must be non-negative'''       )
    if shift < 0:
        raise ValueError('''Shift must be non-negative'''       )
    return ((i << shift) ^ (i >> (32 - shift))) % 2**32





def   __snake_case			(    _UpperCAmelCase       ):
    __a		 =       preprocess(_UpperCAmelCase       )

    __a		 =       [int(2**32 * abs(sin(i + 1       )       )       ) for i in range(64       )]

    # Starting states
    __a		 =       0X67_452_301
    __a		 =       0Xef_cda_b89
    __a		 =       0X98_bad_cfe
    __a		 =       0X10_325_476

    __a		 =       [
        7,
        12,
        17,
        22,
        7,
        12,
        17,
        22,
        7,
        12,
        17,
        22,
        7,
        12,
        17,
        22,
        5,
        9,
        14,
        20,
        5,
        9,
        14,
        20,
        5,
        9,
        14,
        20,
        5,
        9,
        14,
        20,
        4,
        11,
        16,
        23,
        4,
        11,
        16,
        23,
        4,
        11,
        16,
        23,
        4,
        11,
        16,
        23,
        6,
        10,
        15,
        21,
        6,
        10,
        15,
        21,
        6,
        10,
        15,
        21,
        6,
        10,
        15,
        21,
    ]

    # Process bit string in chunks, each with 16 32-char words
    for block_words in get_block_words(_UpperCAmelCase       ):
        __a		 =       aa
        __a		 =       ba
        __a		 =       ca
        __a		 =       da

        # Hash current chunk
        for i in range(64       ):
            if i <= 15:
                # f = (b & c) | (not_32(b) & d)     # Alternate definition for f
                __a		 =       d ^ (b & (c ^ d))
                __a		 =       i
            elif i <= 31:
                # f = (d & b) | (not_32(d) & c)     # Alternate definition for f
                __a		 =       c ^ (d & (b ^ c))
                __a		 =       (5 * i + 1) % 16
            elif i <= 47:
                __a		 =       b ^ c ^ d
                __a		 =       (3 * i + 5) % 16
            else:
                __a		 =       c ^ (b | not_aa(_UpperCAmelCase       ))
                __a		 =       (7 * i) % 16
            __a		 =       (f + a + added_consts[i] + block_words[g]) % 2**32
            __a		 =       d
            __a		 =       c
            __a		 =       b
            __a		 =       sum_aa(_UpperCAmelCase     ,				left_rotate_aa(_UpperCAmelCase     ,				shift_amounts[i]       )       )

        # Add hashed chunk to running total
        __a		 =       sum_aa(_UpperCAmelCase     ,				_UpperCAmelCase       )
        __a		 =       sum_aa(_UpperCAmelCase     ,				_UpperCAmelCase       )
        __a		 =       sum_aa(_UpperCAmelCase     ,				_UpperCAmelCase       )
        __a		 =       sum_aa(_UpperCAmelCase     ,				_UpperCAmelCase       )

    __a		 =       reformat_hex(_UpperCAmelCase       ) + reformat_hex(_UpperCAmelCase       ) + reformat_hex(_UpperCAmelCase       ) + reformat_hex(_UpperCAmelCase       )
    return digest


if __name__ == "__main__":
 import doctest

 doctest.testmod()





