





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


__UpperCAmelCase 						=					logging.get_logger(__name__)

__UpperCAmelCase 						=					{
    '''apple/mobilevit-small''': '''https://huggingface.co/apple/mobilevit-small/resolve/main/config.json''',
    '''apple/mobilevit-x-small''': '''https://huggingface.co/apple/mobilevit-x-small/resolve/main/config.json''',
    '''apple/mobilevit-xx-small''': '''https://huggingface.co/apple/mobilevit-xx-small/resolve/main/config.json''',
    '''apple/deeplabv3-mobilevit-small''': (
        '''https://huggingface.co/apple/deeplabv3-mobilevit-small/resolve/main/config.json'''
    ),
    '''apple/deeplabv3-mobilevit-x-small''': (
        '''https://huggingface.co/apple/deeplabv3-mobilevit-x-small/resolve/main/config.json'''
    ),
    '''apple/deeplabv3-mobilevit-xx-small''': (
        '''https://huggingface.co/apple/deeplabv3-mobilevit-xx-small/resolve/main/config.json'''
    ),
    # See all MobileViT models at https://huggingface.co/models?filter=mobilevit
}

class 						__a							(		a_					):
       __snake_case  :      Any					=						"""mobilevit"""



       def __init__(   self		:      Dict    ,	UpperCAmelCase		:      Optional[Any]=3    ,	UpperCAmelCase		:      int=2_56    ,	UpperCAmelCase		:      int=2    ,	UpperCAmelCase		:      int=[1_44, 1_92, 2_40]    ,	UpperCAmelCase		:      Optional[Any]=[16, 32, 64, 96, 1_28, 1_60, 6_40]    ,	UpperCAmelCase		:      str=4    ,	UpperCAmelCase		:      int=2.0    ,	UpperCAmelCase		:      Any=4.0    ,	UpperCAmelCase		:      Union[str, Any]="silu"    ,	UpperCAmelCase		:      Optional[Any]=3    ,	UpperCAmelCase		:      int=32    ,	UpperCAmelCase		:      List[Any]=0.1    ,	UpperCAmelCase		:      str=0.0    ,	UpperCAmelCase		:      Tuple=0.1    ,	UpperCAmelCase		:      Optional[Any]=0.02    ,	UpperCAmelCase		:      Any=1e-5    ,	UpperCAmelCase		:      int=True    ,	UpperCAmelCase		:      List[Any]=2_56    ,	UpperCAmelCase		:      List[str]=[6, 12, 18]    ,	UpperCAmelCase		:      str=0.1    ,	UpperCAmelCase		:      List[Any]=2_55    ,	**UpperCAmelCase		:      Any    ,	):
           super().__init__(**UpperCAmelCase	)

           lowerCAmelCase_    :		Optional[int] 						=      num_channels
           lowerCAmelCase_    :		Optional[int] 						=      image_size
           lowerCAmelCase_    :		List[str] 						=      patch_size
           lowerCAmelCase_    :		Tuple 						=      hidden_sizes
           lowerCAmelCase_    :		Optional[Any] 						=      neck_hidden_sizes
           lowerCAmelCase_    :		Optional[Any] 						=      num_attention_heads
           lowerCAmelCase_    :		List[str] 						=      mlp_ratio
           lowerCAmelCase_    :		List[str] 						=      expand_ratio
           lowerCAmelCase_    :		List[Any] 						=      hidden_act
           lowerCAmelCase_    :		List[str] 						=      conv_kernel_size
           lowerCAmelCase_    :		List[Any] 						=      output_stride
           lowerCAmelCase_    :		int 						=      hidden_dropout_prob
           lowerCAmelCase_    :		int 						=      attention_probs_dropout_prob
           lowerCAmelCase_    :		Any 						=      classifier_dropout_prob
           lowerCAmelCase_    :		Union[str, Any] 						=      initializer_range
           lowerCAmelCase_    :		Optional[Any] 						=      layer_norm_eps
           lowerCAmelCase_    :		List[Any] 						=      qkv_bias

           # decode head attributes for semantic segmentation
           lowerCAmelCase_    :		Union[str, Any] 						=      aspp_out_channels
           lowerCAmelCase_    :		Tuple 						=      atrous_rates
           lowerCAmelCase_    :		Any 						=      aspp_dropout_prob
           lowerCAmelCase_    :		Dict 						=      semantic_loss_ignore_index






class 						__a							(		a_					):
       __snake_case  :      Dict					=						version.parse("""1.11"""					)



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



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



       @property
       def        A							(   self		:      Union[str, Any]	):
           return 1e-4






'''simple docstring'''







from __future__ import annotations






def       lowerCAmelCase__       (				lowerCamelCase     :			list   ):
       _A     :	Union[str, Any]      =					sorted(lowerCamelCase   )
       _A     :	Tuple      =					len(lowerCamelCase   )
       _A     :	int      =					length >> 1
       return (
           (sorted_list[mid_index] + sorted_list[mid_index - 1]) / 2
           if length % 2 == 0
           else sorted_list[mid_index]
       )






def       lowerCAmelCase__       (				):
       import doctest

       doctest.testmod()


if __name__ == "__main__":
   main()






