


def 							__lowercase       (			__lowerCAmelCase							:    Tuple ,   __lowerCAmelCase							:    Union[str, Any]       ):
       a__					=					0
       a__					=					len(__lowerCAmelCase       ) - 1

       while left <= right:
              # avoid divided by 0 during interpolation
              if sorted_collection[left] == sorted_collection[right]:
                     if sorted_collection[left] == item:
                            return left
                     else:
                            return None

              a__					=					left + ((item - sorted_collection[left]) * (right - left)) // (
                  sorted_collection[right] - sorted_collection[left]
              )

              # out of range check
              if point < 0 or point >= len(__lowerCAmelCase       ):
                     return None

              a__					=					sorted_collection[point]
              if current_item == item:
                     return point
              else:
                     if point < left:
                            a__					=					left
                            a__					=					point
                     elif point > right:
                            a__					=					right
                            a__					=					point
                     else:
                            if item < current_item:
                                   a__					=					point - 1
                            else:
                                   a__					=					point + 1
       return None






def 							__lowercase       (			__lowerCAmelCase							:    Dict ,   __lowerCAmelCase							:    Any ,   __lowerCAmelCase							:    Tuple ,   __lowerCAmelCase							:    Optional[Any]       ):

       # avoid divided by 0 during interpolation
       if sorted_collection[left] == sorted_collection[right]:
              if sorted_collection[left] == item:
                     return left
              else:
                     return None

       a__					=					left + ((item - sorted_collection[left]) * (right - left)) // (
           sorted_collection[right] - sorted_collection[left]
       )

       # out of range check
       if point < 0 or point >= len(__lowerCAmelCase       ):
              return None

       if sorted_collection[point] == item:
              return point
       elif point < left:
              return interpolation_search_by_recursion(__lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase       )
       elif point > right:
              return interpolation_search_by_recursion(__lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase       )
       else:
              if sorted_collection[point] > item:
                     return interpolation_search_by_recursion(
                         __lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase ,   point - 1       )
              else:
                     return interpolation_search_by_recursion(
                         __lowerCAmelCase ,   __lowerCAmelCase ,   point + 1 ,   __lowerCAmelCase       )






def 							__lowercase       (			__lowerCAmelCase							:    Optional[int]       ):
       if collection != sorted(__lowerCAmelCase       ):
              raise ValueError('Collection must be ascending sorted'       )
       return True


if __name__ == "__main__":
      import sys
      snake_case							:	str					      =				0
      if debug == 1:
            snake_case							:	Union[str, Any]					      =				[10, 30, 40, 45, 50, 66, 77, 93]
            try:
                  __assert_sorted(collection)
            except ValueError:
                  sys.exit('''Sequence must be ascending sorted to apply interpolation search''')
            snake_case							:	Union[str, Any]					      =				67

      snake_case							:	Union[str, Any]					      =				interpolation_search(collection, target)
      if result is not None:
            print(f"""{target} found at positions: {result}""")
      else:
            print('''Not found''')








from typing import List

from ...configuration_utils import PretrainedConfig
from ...utils import logging


snake_case							:	Tuple					      =				logging.get_logger(__name__)

snake_case							:	List[Any]					      =				{
    '''snap-research/efficientformer-l1-300''': (
        '''https://huggingface.co/snap-research/efficientformer-l1-300/resolve/main/config.json'''
    ),
}







class 	snake_case_       (lowerCamelCase_				):
					UpperCAmelCase__ :   int   				=      '''efficientformer'''
					def __init__(				self       :List[str]      ,__snake_case       :List[int] = [3, 2, 6, 4]      ,__snake_case       :List[int] = [48, 96, 2_24, 4_48]      ,__snake_case       :List[bool] = [True, True, True, True]      ,__snake_case       :int = 4_48      ,__snake_case       :int = 32      ,__snake_case       :int = 4      ,__snake_case       :int = 7      ,__snake_case       :int = 5      ,__snake_case       :int = 8      ,__snake_case       :int = 4      ,__snake_case       :float = 0.0      ,__snake_case       :int = 16      ,__snake_case       :int = 3      ,__snake_case       :int = 3      ,__snake_case       :int = 3      ,__snake_case       :int = 2      ,__snake_case       :int = 1      ,__snake_case       :float = 0.0      ,__snake_case       :int = 1      ,__snake_case       :bool = True      ,__snake_case       :bool = True      ,__snake_case       :float = 1E-5      ,__snake_case       :str = "gelu"      ,__snake_case       :float = 0.02      ,__snake_case       :float = 1E-12      ,__snake_case       :int = 2_24      ,__snake_case       :float = 1E-05      ,**__snake_case       :Dict      ,) ->   None:
												super().__init__(**__snake_case				)

												a__					=					hidden_act
												a__					=					hidden_dropout_prob
												a__					=					hidden_sizes
												a__					=					num_hidden_layers
												a__					=					num_attention_heads
												a__					=					initializer_range
												a__					=					layer_norm_eps
												a__					=					patch_size
												a__					=					num_channels
												a__					=					depths
												a__					=					mlp_expansion_ratio
												a__					=					downsamples
												a__					=					dim
												a__					=					key_dim
												a__					=					attention_ratio
												a__					=					resolution
												a__					=					pool_size
												a__					=					downsample_patch_size
												a__					=					downsample_stride
												a__					=					downsample_pad
												a__					=					drop_path_rate
												a__					=					num_metaad_blocks
												a__					=					distillation
												a__					=					use_layer_scale
												a__					=					layer_scale_init_value
												a__					=					image_size
												a__					=					batch_norm_eps




