


def  _a			(						__UpperCamelCase ):
     a_    :     Union[str, Any]										=    [0 for i in range(len(__UpperCamelCase ) )]

     # initialize interval's left pointer and right pointer
     a_			,			a_    :     str										=    0, 0

     for i in range(1  ,  len(__UpperCamelCase ) ):
          # case when current index is inside the interval
          if i <= right_pointer:
               a_    :     Dict										=    min(right_pointer - i + 1  ,  z_result[i - left_pointer] )
               a_    :     Dict										=    min_edge

          while go_next(__UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase ):
               z_result[i] += 1

          # if new index's result gives us more right interval,
          # we've to update left_pointer and right_pointer
          if i + z_result[i] - 1 > right_pointer:
               a_			,			a_    :     List[str]										=    i, i + z_result[i] - 1

     return z_result



def  _a			(						__UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase ):
     return i + z_result[i] < len(__UpperCamelCase ) and s[z_result[i]] == s[i + z_result[i]]



def  _a			(						__UpperCamelCase  ,  __UpperCamelCase ):
     a_    :     Optional[int]										=    0
     # concatenate 'pattern' and 'input_str' and call z_function
     # with concatenated string
     a_    :     Union[str, Any]										=    z_function(pattern + input_str )

     for val in z_result:
          # if value is greater then length of the pattern string
          # that means this index is starting position of substring
          # which is equal to pattern string
          if val >= len(__UpperCamelCase ):
               answer += 1

     return answer


if __name__ == "__main__":
       import doctest

       doctest.testmod()







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


__lowerCamelCase        =     logging.get_logger(__name__)

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


class   a__	(						lowerCAmelCase_						,       lowerCAmelCase_    ):
       lowerCamelCase__:     str							    =     """convnextv2"""

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

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



