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


__snake_case         =     logging.get_logger(__name__)

__snake_case         =     {
    '''apple/mobilevitv2-1.0''': '''https://huggingface.co/apple/mobilevitv2-1.0/resolve/main/config.json''',
}







class       __snake_case (  lowerCamelCase__ ):
 __lowerCamelCase     : List[Any] 	=   """mobilevitv2"""
 def __init__(	self		, snake_case__=3		, snake_case__=256		, snake_case__=2		, snake_case__=2.0		, snake_case__="swish"		, snake_case__=3		, snake_case__=32		, snake_case__=0.1		, snake_case__=0.02		, snake_case__=1e-5		, snake_case__=512		, snake_case__=[6, 12, 18]		, snake_case__=0.1		, snake_case__=255		, snake_case__=[2, 4, 3]		, snake_case__=[128, 192, 256]		, snake_case__=1.0		, snake_case__=2		, snake_case__=0.0		, snake_case__=0.0		, **snake_case__		, )						->				Union[str, Any]:
       '''simple docstring'''





       super().__init__(**snake_case__    )

       UpperCAmelCase     :			List[str]     	=num_channels
       UpperCAmelCase     :			Any     	=image_size
       UpperCAmelCase     :			Tuple     	=patch_size
       UpperCAmelCase     :			Tuple     	=expand_ratio
       UpperCAmelCase     :			Union[str, Any]     	=hidden_act
       UpperCAmelCase     :			Any     	=conv_kernel_size
       UpperCAmelCase     :			Tuple     	=output_stride
       UpperCAmelCase     :			List[str]     	=initializer_range
       UpperCAmelCase     :			Dict     	=layer_norm_eps
       UpperCAmelCase     :			Tuple     	=n_attn_blocks
       UpperCAmelCase     :			int     	=base_attn_unit_dims
       UpperCAmelCase     :			int     	=width_multiplier
       UpperCAmelCase     :			Tuple     	=ffn_multiplier
       UpperCAmelCase     :			List[Any]     	=ffn_dropout
       UpperCAmelCase     :			Dict     	=attn_dropout
       UpperCAmelCase     :			Optional[Any]     	=classifier_dropout_prob

       # decode head attributes for semantic segmentation
       UpperCAmelCase     :			Optional[Any]     	=aspp_out_channels
       UpperCAmelCase     :			int     	=atrous_rates
       UpperCAmelCase     :			Dict     	=aspp_dropout_prob
       UpperCAmelCase     :			int     	=semantic_loss_ignore_index







class       __snake_case (  lowerCamelCase__ ):
 __lowerCamelCase     : Optional[int] 	=   version.parse("""1.11""" )
 @property
 def 						UpperCAmelCase__							(	self    )						->				Mapping[str, Mapping[int, str]]:
       '''simple docstring'''





       return OrderedDict([('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''})]    )
 @property
 def 						UpperCAmelCase__							(	self    )						->				Mapping[str, Mapping[int, str]]:
       '''simple docstring'''





       if self.task == "image-classification":
             return OrderedDict([('''logits''', {0: '''batch'''})]    )
       else:
             return OrderedDict([('''last_hidden_state''', {0: '''batch'''}), ('''pooler_output''', {0: '''batch'''})]    )






 @property
 def 						UpperCAmelCase__							(	self    )						->				float:
       '''simple docstring'''





       return 1e-4

from hashlib import mda, shaaaa

__snake_case         =     (shaaaa, mda)







class       __snake_case :
 def __init__(	self		, snake_case__ = 8    )						->				None:
       '''simple docstring'''





       UpperCAmelCase     :			str     	=0b0
       UpperCAmelCase     :			str     	=size
 def 						UpperCAmelCase__							(	self		, snake_case__    )						->				None:
       '''simple docstring'''





       UpperCAmelCase     :			Union[str, Any]     	=self.hash_(snake_case__    )
       self.bitarray |= h
 def 						UpperCAmelCase__							(	self		, snake_case__    )						->				bool:
       '''simple docstring'''





       UpperCAmelCase     :			List[Any]     	=self.hash_(snake_case__    )
       return (h & self.bitarray) == h
 def __contains__(	self		, snake_case__    )						->				bool:
       '''simple docstring'''





       return self.exists(snake_case__    )
 def 						UpperCAmelCase__							(	self		, snake_case__    )						->				str:
       '''simple docstring'''





       UpperCAmelCase     :			Dict     	=bin(snake_case__    )[2:]
       return res.zfill(self.size    )
 @property
 def 						UpperCAmelCase__							(	self    )						->				str:
       '''simple docstring'''





       return self.format_bin(self.bitarray    )
 def 						UpperCAmelCase__							(	self		, snake_case__    )						->				int:
       '''simple docstring'''





       UpperCAmelCase     :			Union[str, Any]     	=0b0
       for func in HASH_FUNCTIONS:
             UpperCAmelCase     :			Optional[Any]     	=(
                 int.from_bytes(func(value.encode()    ).digest()		, '''little'''    ) % self.size
             )
             res |= 2**position
       return res
 def 						UpperCAmelCase__							(	self		, snake_case__    )						->				str:
       '''simple docstring'''





       return self.format_bin(self.hash_(snake_case__    )    )






 @property
 def 						UpperCAmelCase__							(	self    )						->				float:
       '''simple docstring'''





       UpperCAmelCase     :			int     	=bin(self.bitarray    ).count('''1'''    )
       return (n_ones / self.size) ** len(snake_case__    )
