




'''simple docstring'''



from __future__ import annotations

from collections import deque






class 							_a				:





       '''simple docstring'''






       def __init__(      self,							A  ):







             '''simple docstring'''







             SCREAMING_SNAKE_CASE   :      list[dict]    					=						[]
             self.adlist.append(
                 {'value': '', 'next_states': [], 'fail_state': 0, 'output': []}  )

             for keyword in keywords:
                   self.add_keyword(A  )
             self.set_fail_transitions()







       def        UpperCamelCase_							(      self,							A,							A  ):







             '''simple docstring'''







             for state in self.adlist[current_state]["next_states"]:
                   if char == self.adlist[state]["value"]:
                         return state
             return None







       def        UpperCamelCase_							(      self,							A  ):







             '''simple docstring'''







             SCREAMING_SNAKE_CASE   :      List[str]    					=						0
             for character in keyword:
                   SCREAMING_SNAKE_CASE   :      Any    					=						self.find_next_state(A,							A  )
                   if next_state is None:
                         self.adlist.append(
                             {
                                 'value': character,
                                 'next_states': [],
                                 'fail_state': 0,
                                 'output': [],
                             }  )
                         self.adlist[current_state]["next_states"].append(len(self.adlist  ) - 1  )
                         SCREAMING_SNAKE_CASE   :      List[str]    					=						len(self.adlist  ) - 1
                   else:
                         SCREAMING_SNAKE_CASE   :      int    					=						next_state
             self.adlist[current_state]["output"].append(A  )







       def        UpperCamelCase_							(      self  ):







             '''simple docstring'''







             SCREAMING_SNAKE_CASE   :      deque    					=						deque()
             for node in self.adlist[0]["next_states"]:
                   q.append(A  )
                   SCREAMING_SNAKE_CASE   :      Optional[Any]    					=						0
             while q:
                   SCREAMING_SNAKE_CASE   :      List[Any]    					=						q.popleft()
                   for child in self.adlist[r]["next_states"]:
                         q.append(A  )
                         SCREAMING_SNAKE_CASE   :      Optional[Any]    					=						self.adlist[r]['fail_state']
                         while (
                             self.find_next_state(A,							self.adlist[child]['value']  ) is None
                             and state != 0
                         ):
                               SCREAMING_SNAKE_CASE   :      str    					=						self.adlist[state]['fail_state']
                         SCREAMING_SNAKE_CASE   :      int    					=						self.find_next_state(
                             A,							self.adlist[child]['value']  )
                         if self.adlist[child]["fail_state"] is None:
                               SCREAMING_SNAKE_CASE   :      Optional[int]    					=						0
                         SCREAMING_SNAKE_CASE   :      int    					=						(
                             self.adlist[child]['output']
                             + self.adlist[self.adlist[child]['fail_state']]['output']
                         )







       def        UpperCamelCase_							(      self,							A  ):







             '''simple docstring'''







             SCREAMING_SNAKE_CASE   :      dict    					=						{}  # returns a dict with keywords and list of its occurrences
             SCREAMING_SNAKE_CASE   :      Optional[Any]    					=						0
             for i in range(len(A  )  ):
                   while (
                       self.find_next_state(A,							string[i]  ) is None
                       and current_state != 0
                   ):
                         SCREAMING_SNAKE_CASE   :      Union[str, Any]    					=						self.adlist[current_state]['fail_state']
                   SCREAMING_SNAKE_CASE   :      Tuple    					=						self.find_next_state(A,							string[i]  )
                   if next_state is None:
                         SCREAMING_SNAKE_CASE   :      Any    					=						0
                   else:
                         SCREAMING_SNAKE_CASE   :      Dict    					=						next_state
                         for key in self.adlist[current_state]["output"]:
                               if key not in result:
                                     SCREAMING_SNAKE_CASE   :      Dict    					=						[]
                               result[key].append(i - len(A  ) + 1  )
             return result


if __name__ == "__main__":
      import doctest

      doctest.testmod()



"""simple docstring"""


from collections import OrderedDict
from typing import List, Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


UpperCAmelCase__			=    logging.get_logger(__name__)

UpperCAmelCase__			=    {
    """google/efficientnet-b7""": """https://huggingface.co/google/efficientnet-b7/resolve/main/config.json""",
}


class 							a					(		lowerCAmelCase_ ):
    _snake_case  :	Tuple  				=				'efficientnet'


    def __init__(       self						:	int ,					__lowerCAmelCase						:	int = 3 ,					__lowerCAmelCase						:	int = 600 ,					__lowerCAmelCase						:	float = 2.0 ,					__lowerCAmelCase						:	float = 3.1 ,					__lowerCAmelCase						:	int = 8 ,					__lowerCAmelCase						:	List[int] = [3, 3, 5, 3, 5, 5, 3] ,					__lowerCAmelCase						:	List[int] = [32, 16, 24, 40, 80, 112, 192] ,					__lowerCAmelCase						:	List[int] = [16, 24, 40, 80, 112, 192, 320] ,					__lowerCAmelCase						:	List[int] = [] ,					__lowerCAmelCase						:	List[int] = [1, 2, 2, 2, 1, 2, 1] ,					__lowerCAmelCase						:	List[int] = [1, 2, 2, 3, 3, 4, 1] ,					__lowerCAmelCase						:	List[int] = [1, 6, 6, 6, 6, 6, 6] ,					__lowerCAmelCase						:	float = 0.25 ,					__lowerCAmelCase						:	str = "swish" ,					__lowerCAmelCase						:	int = 2560 ,					__lowerCAmelCase						:	str = "mean" ,					__lowerCAmelCase						:	float = 0.02 ,					__lowerCAmelCase						:	float = 0.001 ,					__lowerCAmelCase						:	float = 0.99 ,					__lowerCAmelCase						:	float = 0.5 ,					__lowerCAmelCase						:	float = 0.2 ,					**__lowerCAmelCase						:	Optional[Any] ,					):
      super().__init__(**__lowerCAmelCase       )

      _UpperCAmelCase    			=   num_channels
      _UpperCAmelCase    			=   image_size
      _UpperCAmelCase    			=   width_coefficient
      _UpperCAmelCase    			=   depth_coefficient
      _UpperCAmelCase    			=   depth_divisor
      _UpperCAmelCase    			=   kernel_sizes
      _UpperCAmelCase    			=   in_channels
      _UpperCAmelCase    			=   out_channels
      _UpperCAmelCase    			=   depthwise_padding
      _UpperCAmelCase    			=   strides
      _UpperCAmelCase    			=   num_block_repeats
      _UpperCAmelCase    			=   expand_ratios
      _UpperCAmelCase    			=   squeeze_expansion_ratio
      _UpperCAmelCase    			=   hidden_act
      _UpperCAmelCase    			=   hidden_dim
      _UpperCAmelCase    			=   pooling_type
      _UpperCAmelCase    			=   initializer_range
      _UpperCAmelCase    			=   batch_norm_eps
      _UpperCAmelCase    			=   batch_norm_momentum
      _UpperCAmelCase    			=   dropout_rate
      _UpperCAmelCase    			=   drop_connect_rate
      _UpperCAmelCase    			=   sum(__lowerCAmelCase       ) * 4



class 							a					(		lowerCAmelCase_ ):
    _snake_case  :	Union[str, Any]  				=				version.parse('1.11' )


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


    @property
    def   lowerCAmelCase_	(       self						:	List[Any]       ):
      return 1e-5
