


"""simple docstring"""





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


snake_case__		:     Any    				=				logging.get_logger(__name__)

snake_case__		:     int    				=				{
    '''facebook/convnextv2-tiny-1k-224''': '''https://huggingface.co/facebook/convnextv2-tiny-1k-224/resolve/main/config.json''',
}



class 		snake_case_(       a__							,					a__			):
     __UpperCamelCase  =					'''convnextv2'''






     def __init__(	self  :					Optional[Any]					,				UpperCamelCase_  :					Optional[int]=3					,				UpperCamelCase_  :					Tuple=4					,				UpperCamelCase_  :					Any=4					,				UpperCamelCase_  :					Union[str, Any]=None					,				UpperCamelCase_  :					List[Any]=None					,				UpperCamelCase_  :					Union[str, Any]="gelu"					,				UpperCamelCase_  :					Dict=0.02					,				UpperCamelCase_  :					Union[str, Any]=1E-12					,				UpperCamelCase_  :					List[str]=0.0					,				UpperCamelCase_  :					int=2_2_4					,				UpperCamelCase_  :					Optional[int]=None					,				UpperCamelCase_  :					Optional[Any]=None					,				**UpperCamelCase_  :					Union[str, Any]					,				):
           super().__init__(**UpperCamelCase_				)

           lowerCAmelCase					:	Optional[int]       =   num_channels
           lowerCAmelCase					:	List[Any]       =   patch_size
           lowerCAmelCase					:	List[Any]       =   num_stages
           lowerCAmelCase					:	Union[str, Any]       =   [9_6, 1_9_2, 3_8_4, 7_6_8] if hidden_sizes is None else hidden_sizes
           lowerCAmelCase					:	Any       =   [3, 3, 9, 3] if depths is None else depths
           lowerCAmelCase					:	int       =   hidden_act
           lowerCAmelCase					:	int       =   initializer_range
           lowerCAmelCase					:	Any       =   layer_norm_eps
           lowerCAmelCase					:	List[Any]       =   drop_path_rate
           lowerCAmelCase					:	Union[str, Any]       =   image_size
           lowerCAmelCase					:	Any       =   ['''stem'''] + [F'''stage{idx}''' for idx in range(1					,				len(self.depths				) + 1				)]
           lowerCAmelCase,      lowerCAmelCase					:	Optional[Any]       =   get_aligned_output_features_output_indices(
               out_features=UpperCamelCase_					,				out_indices=UpperCamelCase_					,				stage_names=self.stage_names				)






"""simple docstring"""





from __future__ import annotations



class 		snake_case_:






     def __init__(	self  :					int					,				UpperCamelCase_  :					str					,				UpperCamelCase_  :					str				):
           lowerCAmelCase,      lowerCAmelCase					:	List[str]       =   text, pattern
           lowerCAmelCase,      lowerCAmelCase					:	Union[str, Any]       =   len(UpperCamelCase_				), len(UpperCamelCase_				)






     def      lowerCamelCase__     (	self  :					List[Any]					,				UpperCamelCase_  :					str				):

           for i in range(self.patLen - 1					,				-1					,				-1				):
                 if char == self.pattern[i]:
                       return i
           return -1






     def      lowerCamelCase__     (	self  :					Optional[Any]					,				UpperCamelCase_  :					int				):

           for i in range(self.patLen - 1					,				-1					,				-1				):
                 if self.pattern[i] != self.text[current_pos + i]:
                       return current_pos + i
           return -1






     def      lowerCamelCase__     (	self  :					Dict				):
           # searches pattern in text and returns index positions
           lowerCAmelCase					:	Union[str, Any]       =   []
           for i in range(self.textLen - self.patLen + 1				):
                 lowerCAmelCase					:	str       =   self.mismatch_in_text(UpperCamelCase_				)
                 if mismatch_index == -1:
                       positions.append(UpperCamelCase_				)
                 else:
                       lowerCAmelCase					:	Optional[Any]       =   self.match_in_pattern(self.text[mismatch_index]				)
                       lowerCAmelCase					:	int       =   (
                           mismatch_index - match_index
                       )  # shifting index lgtm [py/multiple-definition]
           return positions



snake_case__		:     str    				=				'''ABAABA'''
snake_case__		:     List[str]    				=				'''AB'''
snake_case__		:     Union[str, Any]    				=				BoyerMooreSearch(text, pattern)
snake_case__		:     Optional[Any]    				=				bms.bad_character_heuristic()

if len(positions) == 0:
 print('''No match found''')
else:
 print('''Pattern found in following positions: ''')
 print(positions)


