




def 				lowerCAmelCase_	(     snake_case_     ):
      _A							:     str			=						[0 for i in range(len(snake_case_     )     )]

      # initialize interval's left pointer and right pointer
      _A			,   _A							:     Any			=						0, 0

      for i in range(1,len(snake_case_     )     ):
            # case when current index is inside the interval
            if i <= right_pointer:
                  _A							:     str			=						min(right_pointer - i + 1,z_result[i - left_pointer]     )
                  _A							:     Optional[int]			=						min_edge

            while go_next(snake_case_,snake_case_,snake_case_     ):
                  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							:     Tuple			=						i, i + z_result[i] - 1

      return z_result







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







def 				lowerCAmelCase_	(     snake_case_,snake_case_     ):
      _A							:     List[Any]			=						0
      # concatenate 'pattern' and 'input_str' and call z_function
      # with concatenated string
      _A							:     Optional[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(snake_case_     ):
                  answer += 1

      return answer


if __name__ == "__main__":
  import doctest

  doctest.testmod()







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


_snake_case										=       logging.get_logger(__name__)

_snake_case										=       {
    "google/fnet-base": "https://huggingface.co/google/fnet-base/resolve/main/config.json",
    "google/fnet-large": "https://huggingface.co/google/fnet-large/resolve/main/config.json"
    # See all FNet models at https://huggingface.co/models?filter=fnet
}







class 						lowercase							(   UpperCamelCase__		):
     _a							 =						"fnet"

     def __init__(  self		,     _a=3_2000		,     _a=768		,     _a=12		,     _a=3072		,     _a="gelu_new"		,     _a=0.1		,     _a=512		,     _a=4		,     _a=0.02		,     _a=1e-12		,     _a=False		,     _a=512		,     _a=3		,     _a=1		,     _a=2		,     **_a		,     )						->							int:
           super().__init__(pad_token_id=_a		,     bos_token_id=_a		,     eos_token_id=_a		,     **_a				)

           _A							:     Any			=						vocab_size
           _A							:     str			=						max_position_embeddings
           _A							:     Optional[Any]			=						hidden_size
           _A							:     List[str]			=						num_hidden_layers
           _A							:     List[str]			=						intermediate_size
           _A							:     List[Any]			=						hidden_act
           _A							:     List[str]			=						hidden_dropout_prob
           _A							:     List[str]			=						initializer_range
           _A							:     List[Any]			=						type_vocab_size
           _A							:     List[Any]			=						layer_norm_eps
           _A							:     List[str]			=						use_tpu_fourier_optimizations
           _A							:     str			=						tpu_short_seq_length

