
"""simple docstring"""



from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


a       :						List[Any]       		=		logging.get_logger(__name__)

a       :						Tuple       		=		{
    '''shi-labs/nat-mini-in1k-224''': '''https://huggingface.co/shi-labs/nat-mini-in1k-224/resolve/main/config.json''',
    # See all Nat models at https://huggingface.co/models?filter=nat
}




class 		a_    (			_UpperCAmelCase  ,    _UpperCAmelCase						):
    a   :					int			     =					'nat'

    a   :					List[Any]			     =					{
        'num_attention_heads': 'num_heads',
        'num_hidden_layers': 'num_layers',
    }







    def __init__(      self      :							Optional[int]  ,       __UpperCamelCase      :							int=4  ,       __UpperCamelCase      :							Optional[int]=3  ,       __UpperCamelCase      :							Optional[int]=64  ,       __UpperCamelCase      :							str=[3, 4, 6, 5]  ,       __UpperCamelCase      :							Optional[Any]=[2, 4, 8, 16]  ,       __UpperCamelCase      :							List[Any]=7  ,       __UpperCamelCase      :							Optional[int]=3.0  ,       __UpperCamelCase      :							Union[str, Any]=True  ,       __UpperCamelCase      :							Optional[Any]=0.0  ,       __UpperCamelCase      :							Any=0.0  ,       __UpperCamelCase      :							Any=0.1  ,       __UpperCamelCase      :							Tuple="gelu"  ,       __UpperCamelCase      :							Tuple=0.0_2  ,       __UpperCamelCase      :							int=1e-5  ,       __UpperCamelCase      :							Dict=0.0  ,       __UpperCamelCase      :							Dict=None  ,       __UpperCamelCase      :							Union[str, Any]=None  ,       **__UpperCamelCase      :							int  ,       )		->Dict:






        '''simple docstring'''






        super().__init__(**__UpperCamelCase  )

        _UpperCAmelCase        = patch_size
        _UpperCAmelCase        = num_channels
        _UpperCAmelCase        = embed_dim
        _UpperCAmelCase        = depths
        _UpperCAmelCase        = len(__UpperCamelCase  )
        _UpperCAmelCase        = num_heads
        _UpperCAmelCase        = kernel_size
        _UpperCAmelCase        = mlp_ratio
        _UpperCAmelCase        = qkv_bias
        _UpperCAmelCase        = hidden_dropout_prob
        _UpperCAmelCase        = attention_probs_dropout_prob
        _UpperCAmelCase        = drop_path_rate
        _UpperCAmelCase        = hidden_act
        _UpperCAmelCase        = layer_norm_eps
        _UpperCAmelCase        = initializer_range
        # we set the hidden_size attribute in order to make Nat work with VisionEncoderDecoderModel
        # this indicates the channel dimension after the last stage of the model
        _UpperCAmelCase        = int(embed_dim * 2 ** (len(__UpperCamelCase  ) - 1)  )
        _UpperCAmelCase        = layer_scale_init_value
        _UpperCAmelCase        = ["""stem"""] + [f"""stage{idx}""" for idx in range(1  ,       len(__UpperCamelCase  ) + 1  )]
        _UpperCAmelCase     ,_UpperCAmelCase        = get_aligned_output_features_output_indices(
            out_features=__UpperCamelCase  ,       out_indices=__UpperCamelCase  ,       stage_names=self.stage_names  )

"""simple docstring"""



def 			_UpperCamelCase						(    _A   )     ->	int:





    """simple docstring"""

    if not isinstance(_A       ,   _A   ) or number < 0:
        raise ValueError("""Input must be a non-negative integer"""   )

    _UpperCAmelCase        = 0
    while number:
        # This way we arrive at next set bit (next 1) instead of looping
        # through each bit and checking for 1s hence the
        # loop won't run 32 times it will only run the number of `1` times
        number &= number - 1
        count += 1
    return count


if __name__ == "__main__":
 import doctest

 doctest.testmod()