



"""simple docstring"""





from collections import deque
from math import floor
from random import random
from time import time
class    lowercase__     :







       '''simple docstring'''


       def __init__(							self    :						int					)				->		Union[str, Any]:


             '''simple docstring'''




             UpperCAmelCase_    				=							{}



       def   lowercase__       (							self    :						Union[str, Any]	,       _UpperCAmelCase    :						Dict	,       _UpperCAmelCase    :						List[str]	,       _UpperCAmelCase    :						List[str]=1					)				->		Dict:


             '''simple docstring'''




             if self.graph.get(_UpperCAmelCase					):
                   if self.graph[u].count([w, v]					) == 0:
                         self.graph[u].append([w, v]					)
             else:
                   UpperCAmelCase_    				=							[[w, v]]
             if not self.graph.get(_UpperCAmelCase					):
                   UpperCAmelCase_    				=							[]



       def   lowercase__       (							self    :						Any					)				->		List[str]:


             '''simple docstring'''




             return list(self.graph					)



       def   lowercase__       (							self    :						Optional[Any]	,       _UpperCAmelCase    :						List[str]	,       _UpperCAmelCase    :						List[Any]					)				->		int:


             '''simple docstring'''




             if self.graph.get(_UpperCAmelCase					):
                   for _ in self.graph[u]:
                         if _[1] == v:
                               self.graph[u].remove(_UpperCAmelCase					)



       def   lowercase__       (							self    :						Optional[Any]	,       _UpperCAmelCase    :						int=-2	,       _UpperCAmelCase    :						Union[str, Any]=-1					)				->		Tuple:


             '''simple docstring'''




             if s == d:
                   return []
             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							[]
             if s == -2:
                   UpperCAmelCase_    				=							list(self.graph					)[0]
             stack.append(_UpperCAmelCase					)
             visited.append(_UpperCAmelCase					)
             UpperCAmelCase_    				=							s

             while True:
                   # check if there is any non isolated nodes
                   if len(self.graph[s]					) != 0:
                         UpperCAmelCase_    				=							s
                         for node in self.graph[s]:
                               if visited.count(node[1]					) < 1:
                                     if node[1] == d:
                                           visited.append(_UpperCAmelCase					)
                                           return visited
                                     else:
                                           stack.append(node[1]					)
                                           visited.append(node[1]					)
                                           UpperCAmelCase_    				=							node[1]
                                           break

            # check if all the children are visited
                   if s == ss:
                         stack.pop()
                         if len(_UpperCAmelCase					) != 0:
                               UpperCAmelCase_    				=							stack[len(_UpperCAmelCase					) - 1]
                   else:
                         UpperCAmelCase_    				=							ss

                   # check if se have reached the starting point
                   if len(_UpperCAmelCase					) == 0:
                         return visited



       def   lowercase__       (							self    :						List[Any]	,       _UpperCAmelCase    :						List[Any]=-1					)				->		List[str]:


             '''simple docstring'''




             if c == -1:
                   UpperCAmelCase_    				=							floor(random() * 10000					) + 10
             for i in range(_UpperCAmelCase					):
                   # every vertex has max 100 edges
                   for _ in range(floor(random() * 102					) + 1					):
                         UpperCAmelCase_    				=							floor(random() * c					) + 1
                         if n != i:
                               self.add_pair(_UpperCAmelCase	,       _UpperCAmelCase	,       1					)



       def   lowercase__       (							self    :						Dict	,       _UpperCAmelCase    :						Union[str, Any]=-2					)				->		Dict:


             '''simple docstring'''




             UpperCAmelCase_    				=							deque()
             UpperCAmelCase_    				=							[]
             if s == -2:
                   UpperCAmelCase_    				=							list(self.graph					)[0]
             d.append(_UpperCAmelCase					)
             visited.append(_UpperCAmelCase					)
             while d:
                   UpperCAmelCase_    				=							d.popleft()
                   if len(self.graph[s]					) != 0:
                         for node in self.graph[s]:
                               if visited.count(node[1]					) < 1:
                                     d.append(node[1]					)
                                     visited.append(node[1]					)
             return visited



       def   lowercase__       (							self    :						int	,       _UpperCAmelCase    :						str					)				->		str:


             '''simple docstring'''




             UpperCAmelCase_    				=							0
             for x in self.graph:
                   for y in self.graph[x]:
                         if y[1] == u:
                               count += 1
             return count



       def   lowercase__       (							self    :						Dict	,       _UpperCAmelCase    :						Tuple					)				->		Union[str, Any]:


             '''simple docstring'''




             return len(self.graph[u]					)



       def   lowercase__       (							self    :						Optional[int]	,       _UpperCAmelCase    :						Any=-2					)				->		int:


             '''simple docstring'''




             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							[]
             if s == -2:
                   UpperCAmelCase_    				=							list(self.graph					)[0]
             stack.append(_UpperCAmelCase					)
             visited.append(_UpperCAmelCase					)
             UpperCAmelCase_    				=							s
             UpperCAmelCase_    				=							[]

             while True:
                   # check if there is any non isolated nodes
                   if len(self.graph[s]					) != 0:
                         UpperCAmelCase_    				=							s
                         for node in self.graph[s]:
                               if visited.count(node[1]					) < 1:
                                     stack.append(node[1]					)
                                     visited.append(node[1]					)
                                     UpperCAmelCase_    				=							node[1]
                                     break

            # check if all the children are visited
                   if s == ss:
                         sorted_nodes.append(stack.pop()					)
                         if len(_UpperCAmelCase					) != 0:
                               UpperCAmelCase_    				=							stack[len(_UpperCAmelCase					) - 1]
                   else:
                         UpperCAmelCase_    				=							ss

                   # check if se have reached the starting point
                   if len(_UpperCAmelCase					) == 0:
                         return sorted_nodes



       def   lowercase__       (							self    :						int					)				->		Optional[Any]:


             '''simple docstring'''




             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							list(self.graph					)[0]
             stack.append(_UpperCAmelCase					)
             visited.append(_UpperCAmelCase					)
             UpperCAmelCase_    				=							-2
             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							s
             UpperCAmelCase_    				=							False
             UpperCAmelCase_    				=							set()

             while True:
                   # check if there is any non isolated nodes
                   if len(self.graph[s]					) != 0:
                         UpperCAmelCase_    				=							s
                         for node in self.graph[s]:
                               if (
                                   visited.count(node[1]					) > 0
                                   and node[1] != parent
                                   and indirect_parents.count(node[1]					) > 0
                                   and not on_the_way_back
                               ):
                                     UpperCAmelCase_    				=							len(_UpperCAmelCase					) - 1
                                     while len_stack >= 0:
                                           if stack[len_stack] == node[1]:
                                                 anticipating_nodes.add(node[1]					)
                                                 break
                                           else:
                                                 anticipating_nodes.add(stack[len_stack]					)
                                                 len_stack -= 1
                               if visited.count(node[1]					) < 1:
                                     stack.append(node[1]					)
                                     visited.append(node[1]					)
                                     UpperCAmelCase_    				=							node[1]
                                     break

            # check if all the children are visited
                   if s == ss:
                         stack.pop()
                         UpperCAmelCase_    				=							True
                         if len(_UpperCAmelCase					) != 0:
                               UpperCAmelCase_    				=							stack[len(_UpperCAmelCase					) - 1]
                   else:
                         UpperCAmelCase_    				=							False
                         indirect_parents.append(_UpperCAmelCase					)
                         UpperCAmelCase_    				=							s
                         UpperCAmelCase_    				=							ss

                   # check if se have reached the starting point
                   if len(_UpperCAmelCase					) == 0:
                         return list(_UpperCAmelCase					)



       def   lowercase__       (							self    :						List[Any]					)				->		List[str]:


             '''simple docstring'''




             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							list(self.graph					)[0]
             stack.append(_UpperCAmelCase					)
             visited.append(_UpperCAmelCase					)
             UpperCAmelCase_    				=							-2
             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							s
             UpperCAmelCase_    				=							False
             UpperCAmelCase_    				=							set()

             while True:
                   # check if there is any non isolated nodes
                   if len(self.graph[s]					) != 0:
                         UpperCAmelCase_    				=							s
                         for node in self.graph[s]:
                               if (
                                   visited.count(node[1]					) > 0
                                   and node[1] != parent
                                   and indirect_parents.count(node[1]					) > 0
                                   and not on_the_way_back
                               ):
                                     UpperCAmelCase_    				=							len(_UpperCAmelCase					) - 1
                                     while len_stack_minus_one >= 0:
                                           if stack[len_stack_minus_one] == node[1]:
                                                 anticipating_nodes.add(node[1]					)
                                                 break
                                           else:
                                                 return True
                               if visited.count(node[1]					) < 1:
                                     stack.append(node[1]					)
                                     visited.append(node[1]					)
                                     UpperCAmelCase_    				=							node[1]
                                     break

            # check if all the children are visited
                   if s == ss:
                         stack.pop()
                         UpperCAmelCase_    				=							True
                         if len(_UpperCAmelCase					) != 0:
                               UpperCAmelCase_    				=							stack[len(_UpperCAmelCase					) - 1]
                   else:
                         UpperCAmelCase_    				=							False
                         indirect_parents.append(_UpperCAmelCase					)
                         UpperCAmelCase_    				=							s
                         UpperCAmelCase_    				=							ss

                   # check if se have reached the starting point
                   if len(_UpperCAmelCase					) == 0:
                         return False



       def   lowercase__       (							self    :						Optional[Any]	,       _UpperCAmelCase    :						Dict=-2	,       _UpperCAmelCase    :						Tuple=-1					)				->		Optional[Any]:


             '''simple docstring'''




             UpperCAmelCase_    				=							time()
             self.dfs(_UpperCAmelCase	,       _UpperCAmelCase					)
             UpperCAmelCase_    				=							time()
             return end - begin







       def   lowercase__       (							self    :						List[str]	,       _UpperCAmelCase    :						Optional[Any]=-2					)				->		Tuple:


             '''simple docstring'''




             UpperCAmelCase_    				=							time()
             self.bfs(_UpperCAmelCase					)
             UpperCAmelCase_    				=							time()
             return end - begin



class    lowercase__     :







       '''simple docstring'''


       def __init__(							self    :						int					)				->		int:


             '''simple docstring'''




             UpperCAmelCase_    				=							{}



       def   lowercase__       (							self    :						str	,       _UpperCAmelCase    :						Union[str, Any]	,       _UpperCAmelCase    :						Tuple	,       _UpperCAmelCase    :						Any=1					)				->		Tuple:


             '''simple docstring'''




             if self.graph.get(_UpperCAmelCase					):
                   # if there already is a edge
                   if self.graph[u].count([w, v]					) == 0:
                         self.graph[u].append([w, v]					)
             else:
                   # if u does not exist
                   UpperCAmelCase_    				=							[[w, v]]
             # add the other way
             if self.graph.get(_UpperCAmelCase					):
                   # if there already is a edge
                   if self.graph[v].count([w, u]					) == 0:
                         self.graph[v].append([w, u]					)
             else:
                   # if u does not exist
                   UpperCAmelCase_    				=							[[w, u]]



       def   lowercase__       (							self    :						Dict	,       _UpperCAmelCase    :						List[Any]	,       _UpperCAmelCase    :						List[Any]					)				->		List[Any]:


             '''simple docstring'''




             if self.graph.get(_UpperCAmelCase					):
                   for _ in self.graph[u]:
                         if _[1] == v:
                               self.graph[u].remove(_UpperCAmelCase					)
        # the other way round
             if self.graph.get(_UpperCAmelCase					):
                   for _ in self.graph[v]:
                         if _[1] == u:
                               self.graph[v].remove(_UpperCAmelCase					)



       def   lowercase__       (							self    :						int	,       _UpperCAmelCase    :						Dict=-2	,       _UpperCAmelCase    :						Optional[Any]=-1					)				->		Any:


             '''simple docstring'''




             if s == d:
                   return []
             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							[]
             if s == -2:
                   UpperCAmelCase_    				=							list(self.graph					)[0]
             stack.append(_UpperCAmelCase					)
             visited.append(_UpperCAmelCase					)
             UpperCAmelCase_    				=							s

             while True:
                   # check if there is any non isolated nodes
                   if len(self.graph[s]					) != 0:
                         UpperCAmelCase_    				=							s
                         for node in self.graph[s]:
                               if visited.count(node[1]					) < 1:
                                     if node[1] == d:
                                           visited.append(_UpperCAmelCase					)
                                           return visited
                                     else:
                                           stack.append(node[1]					)
                                           visited.append(node[1]					)
                                           UpperCAmelCase_    				=							node[1]
                                           break

            # check if all the children are visited
                   if s == ss:
                         stack.pop()
                         if len(_UpperCAmelCase					) != 0:
                               UpperCAmelCase_    				=							stack[len(_UpperCAmelCase					) - 1]
                   else:
                         UpperCAmelCase_    				=							ss

                   # check if se have reached the starting point
                   if len(_UpperCAmelCase					) == 0:
                         return visited



       def   lowercase__       (							self    :						Optional[int]	,       _UpperCAmelCase    :						List[Any]=-1					)				->		Any:


             '''simple docstring'''




             if c == -1:
                   UpperCAmelCase_    				=							floor(random() * 10000					) + 10
             for i in range(_UpperCAmelCase					):
                   # every vertex has max 100 edges
                   for _ in range(floor(random() * 102					) + 1					):
                         UpperCAmelCase_    				=							floor(random() * c					) + 1
                         if n != i:
                               self.add_pair(_UpperCAmelCase	,       _UpperCAmelCase	,       1					)



       def   lowercase__       (							self    :						Optional[Any]	,       _UpperCAmelCase    :						Optional[Any]=-2					)				->		str:


             '''simple docstring'''




             UpperCAmelCase_    				=							deque()
             UpperCAmelCase_    				=							[]
             if s == -2:
                   UpperCAmelCase_    				=							list(self.graph					)[0]
             d.append(_UpperCAmelCase					)
             visited.append(_UpperCAmelCase					)
             while d:
                   UpperCAmelCase_    				=							d.popleft()
                   if len(self.graph[s]					) != 0:
                         for node in self.graph[s]:
                               if visited.count(node[1]					) < 1:
                                     d.append(node[1]					)
                                     visited.append(node[1]					)
             return visited



       def   lowercase__       (							self    :						Optional[int]	,       _UpperCAmelCase    :						List[Any]					)				->		Union[str, Any]:


             '''simple docstring'''




             return len(self.graph[u]					)



       def   lowercase__       (							self    :						Optional[Any]					)				->		Any:


             '''simple docstring'''




             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							list(self.graph					)[0]
             stack.append(_UpperCAmelCase					)
             visited.append(_UpperCAmelCase					)
             UpperCAmelCase_    				=							-2
             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							s
             UpperCAmelCase_    				=							False
             UpperCAmelCase_    				=							set()

             while True:
                   # check if there is any non isolated nodes
                   if len(self.graph[s]					) != 0:
                         UpperCAmelCase_    				=							s
                         for node in self.graph[s]:
                               if (
                                   visited.count(node[1]					) > 0
                                   and node[1] != parent
                                   and indirect_parents.count(node[1]					) > 0
                                   and not on_the_way_back
                               ):
                                     UpperCAmelCase_    				=							len(_UpperCAmelCase					) - 1
                                     while len_stack >= 0:
                                           if stack[len_stack] == node[1]:
                                                 anticipating_nodes.add(node[1]					)
                                                 break
                                           else:
                                                 anticipating_nodes.add(stack[len_stack]					)
                                                 len_stack -= 1
                               if visited.count(node[1]					) < 1:
                                     stack.append(node[1]					)
                                     visited.append(node[1]					)
                                     UpperCAmelCase_    				=							node[1]
                                     break

            # check if all the children are visited
                   if s == ss:
                         stack.pop()
                         UpperCAmelCase_    				=							True
                         if len(_UpperCAmelCase					) != 0:
                               UpperCAmelCase_    				=							stack[len(_UpperCAmelCase					) - 1]
                   else:
                         UpperCAmelCase_    				=							False
                         indirect_parents.append(_UpperCAmelCase					)
                         UpperCAmelCase_    				=							s
                         UpperCAmelCase_    				=							ss

                   # check if se have reached the starting point
                   if len(_UpperCAmelCase					) == 0:
                         return list(_UpperCAmelCase					)



       def   lowercase__       (							self    :						int					)				->		Dict:


             '''simple docstring'''




             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							list(self.graph					)[0]
             stack.append(_UpperCAmelCase					)
             visited.append(_UpperCAmelCase					)
             UpperCAmelCase_    				=							-2
             UpperCAmelCase_    				=							[]
             UpperCAmelCase_    				=							s
             UpperCAmelCase_    				=							False
             UpperCAmelCase_    				=							set()

             while True:
                   # check if there is any non isolated nodes
                   if len(self.graph[s]					) != 0:
                         UpperCAmelCase_    				=							s
                         for node in self.graph[s]:
                               if (
                                   visited.count(node[1]					) > 0
                                   and node[1] != parent
                                   and indirect_parents.count(node[1]					) > 0
                                   and not on_the_way_back
                               ):
                                     UpperCAmelCase_    				=							len(_UpperCAmelCase					) - 1
                                     while len_stack_minus_one >= 0:
                                           if stack[len_stack_minus_one] == node[1]:
                                                 anticipating_nodes.add(node[1]					)
                                                 break
                                           else:
                                                 return True
                               if visited.count(node[1]					) < 1:
                                     stack.append(node[1]					)
                                     visited.append(node[1]					)
                                     UpperCAmelCase_    				=							node[1]
                                     break

            # check if all the children are visited
                   if s == ss:
                         stack.pop()
                         UpperCAmelCase_    				=							True
                         if len(_UpperCAmelCase					) != 0:
                               UpperCAmelCase_    				=							stack[len(_UpperCAmelCase					) - 1]
                   else:
                         UpperCAmelCase_    				=							False
                         indirect_parents.append(_UpperCAmelCase					)
                         UpperCAmelCase_    				=							s
                         UpperCAmelCase_    				=							ss

                   # check if se have reached the starting point
                   if len(_UpperCAmelCase					) == 0:
                         return False



       def   lowercase__       (							self    :						Dict					)				->		str:


             '''simple docstring'''




             return list(self.graph					)



       def   lowercase__       (							self    :						Optional[Any]	,       _UpperCAmelCase    :						Tuple=-2	,       _UpperCAmelCase    :						Tuple=-1					)				->		List[str]:


             '''simple docstring'''




             UpperCAmelCase_    				=							time()
             self.dfs(_UpperCAmelCase	,       _UpperCAmelCase					)
             UpperCAmelCase_    				=							time()
             return end - begin







       def   lowercase__       (							self    :						Optional[Any]	,       _UpperCAmelCase    :						Optional[Any]=-2					)				->		int:


             '''simple docstring'''




             UpperCAmelCase_    				=							time()
             self.bfs(_UpperCAmelCase					)
             UpperCAmelCase_    				=							time()
             return end - begin









"""simple docstring"""





from collections import OrderedDict
from typing import Mapping

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


lowerCamelCase      =		logging.get_logger(__name__)

lowerCamelCase      =		{
    """YituTech/conv-bert-base""": """https://huggingface.co/YituTech/conv-bert-base/resolve/main/config.json""",
    """YituTech/conv-bert-medium-small""": (
        """https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/config.json"""
    ),
    """YituTech/conv-bert-small""": """https://huggingface.co/YituTech/conv-bert-small/resolve/main/config.json""",
    # See all ConvBERT models at https://huggingface.co/models?filter=convbert
}
class    lowercase__     (					SCREAMING_SNAKE_CASE   ):







       '''simple docstring'''


       UpperCamelCase		=  '''convbert'''



       def __init__(							self    :						Any	,       _UpperCAmelCase    :						Optional[int]=30522	,       _UpperCAmelCase    :						Tuple=768	,       _UpperCAmelCase    :						Optional[int]=12	,       _UpperCAmelCase    :						Dict=12	,       _UpperCAmelCase    :						Any=3072	,       _UpperCAmelCase    :						Dict="gelu"	,       _UpperCAmelCase    :						Optional[int]=0.1	,       _UpperCAmelCase    :						str=0.1	,       _UpperCAmelCase    :						Tuple=512	,       _UpperCAmelCase    :						Optional[Any]=2	,       _UpperCAmelCase    :						Union[str, Any]=0.02	,       _UpperCAmelCase    :						Dict=1e-12	,       _UpperCAmelCase    :						Optional[int]=1	,       _UpperCAmelCase    :						int=0	,       _UpperCAmelCase    :						Optional[Any]=2	,       _UpperCAmelCase    :						List[Any]=768	,       _UpperCAmelCase    :						Optional[int]=2	,       _UpperCAmelCase    :						str=9	,       _UpperCAmelCase    :						List[Any]=1	,       _UpperCAmelCase    :						Optional[Any]=None	,       **_UpperCAmelCase    :						str	,       )				->		List[Any]:


             '''simple docstring'''




             super().__init__(
                 pad_token_id=_UpperCAmelCase	,       bos_token_id=_UpperCAmelCase	,       eos_token_id=_UpperCAmelCase	,       **_UpperCAmelCase	,       )

             UpperCAmelCase_    				=							vocab_size
             UpperCAmelCase_    				=							hidden_size
             UpperCAmelCase_    				=							num_hidden_layers
             UpperCAmelCase_    				=							num_attention_heads
             UpperCAmelCase_    				=							intermediate_size
             UpperCAmelCase_    				=							hidden_act
             UpperCAmelCase_    				=							hidden_dropout_prob
             UpperCAmelCase_    				=							attention_probs_dropout_prob
             UpperCAmelCase_    				=							max_position_embeddings
             UpperCAmelCase_    				=							type_vocab_size
             UpperCAmelCase_    				=							initializer_range
             UpperCAmelCase_    				=							layer_norm_eps
             UpperCAmelCase_    				=							embedding_size
             UpperCAmelCase_    				=							head_ratio
             UpperCAmelCase_    				=							conv_kernel_size
             UpperCAmelCase_    				=							num_groups
             UpperCAmelCase_    				=							classifier_dropout



class    lowercase__     (					SCREAMING_SNAKE_CASE   ):







       '''simple docstring'''


       @property
       def   lowercase__       (							self    :						Dict					)				->		Mapping[str, Mapping[int, str]]:


             '''simple docstring'''




             if self.task == "multiple-choice":
                   UpperCAmelCase_    				=							{0: "batch", 1: "choice", 2: "sequence"}
             else:
                   UpperCAmelCase_    				=							{0: "batch", 1: "sequence"}
             return OrderedDict(
                 [
                     ("input_ids", dynamic_axis),
                     ("attention_mask", dynamic_axis),
                     ("token_type_ids", dynamic_axis),
                 ]					)




