

"""simple docstring"""



class 					a						:



    """simple docstring"""



    def __init__(     self: int       ):






         """simple docstring"""


         A__										=  0
         A__										=  0
         A__										=  {}

    def 				UpperCamelCase	(     self: int    ,						UpperCamelCase: Any       ):






         """simple docstring"""


         if vertex not in self.adjacency:
              A__										=  {}
              self.num_vertices += 1

    def 				UpperCamelCase	(     self: Optional[int]    ,						UpperCamelCase: List[Any]    ,						UpperCamelCase: List[Any]    ,						UpperCamelCase: List[Any]       ):






         """simple docstring"""


         self.add_vertex(UpperCamelCase       )
         self.add_vertex(UpperCamelCase       )

         if head == tail:
              return

         A__										=  weight
         A__										=  weight

    def 				UpperCamelCase	(     self: Optional[int]       ):






         """simple docstring"""


         A__										=  self.get_edges()
         for edge in edges:
              A__			,				A__			,				A__										=  edge
              edges.remove((tail, head, weight)       )
         for i in range(len(UpperCamelCase       )       ):
              A__										=  list(edges[i]       )

         edges.sort(key=lambda UpperCamelCase       : e[2]       )
         for i in range(len(UpperCamelCase       ) - 1       ):
              if edges[i][2] >= edges[i + 1][2]:
                   A__										=  edges[i][2] + 1
         for edge in edges:
              A__			,				A__			,				A__										=  edge
              A__										=  weight
              A__										=  weight

    def __str__(     self: Any       ):






         """simple docstring"""


         A__										=  """"""
         for tail in self.adjacency:
              for head in self.adjacency[tail]:
                   A__										=  self.adjacency[head][tail]
                   string += f"""{head} -> {tail} == {weight}\n"""
         return string.rstrip("""\n"""       )

    def 				UpperCamelCase	(     self: Tuple       ):






         """simple docstring"""


         A__										=  []
         for tail in self.adjacency:
              for head in self.adjacency[tail]:
                   output.append((tail, head, self.adjacency[head][tail])       )
         return output

    def 				UpperCamelCase	(     self: List[Any]       ):






         """simple docstring"""


         return self.adjacency.keys()

    @staticmethod
    def 				UpperCamelCase	(     UpperCamelCase: str=None    ,						UpperCamelCase: Union[str, Any]=None       ):






         """simple docstring"""


         A__										=  Graph()
         if vertices is None:
              A__										=  []
         if edges is None:
              A__										=  []
         for vertex in vertices:
              g.add_vertex(UpperCamelCase       )
         for edge in edges:
              g.add_edge(*UpperCamelCase       )
         return g



    class 					a						:



        """simple docstring"""



        def __init__(     self: int       ):






             """simple docstring"""


             A__										=  {}
             A__										=  {}

        def __len__(     self: Dict       ):






             """simple docstring"""


             return len(self.parent       )

        def 				UpperCamelCase	(     self: int    ,						UpperCamelCase: Any       ):






             """simple docstring"""


             if item in self.parent:
                  return self.find(UpperCamelCase       )

             A__										=  item
             A__										=  0
             return item

        def 				UpperCamelCase	(     self: int    ,						UpperCamelCase: Any       ):






             """simple docstring"""


             if item not in self.parent:
                  return self.make_set(UpperCamelCase       )
             if item != self.parent[item]:
                  A__										=  self.find(self.parent[item]       )
             return self.parent[item]





        def 				UpperCamelCase	(     self: List[str]    ,						UpperCamelCase: Any    ,						UpperCamelCase: str       ):






             """simple docstring"""


             A__										=  self.find(UpperCamelCase       )
             A__										=  self.find(UpperCamelCase       )

             if roota == roota:
                  return roota

             if self.rank[roota] > self.rank[roota]:
                  A__										=  roota
                  return roota

             if self.rank[roota] < self.rank[roota]:
                  A__										=  roota
                  return roota

             if self.rank[roota] == self.rank[roota]:
                  self.rank[roota] += 1
                  A__										=  roota
                  return roota
             return None

    @staticmethod
    def 				UpperCamelCase	(     UpperCamelCase: Any       ):






         """simple docstring"""


         A__										=  graph.num_vertices

         A__										=  Graph.UnionFind()
         A__										=  []
         while num_components > 1:
              A__										=  {}
              for vertex in graph.get_vertices():
                   A__										=  -1

              A__										=  graph.get_edges()
              for edge in edges:
                   A__			,				A__			,				A__										=  edge
                   edges.remove((tail, head, weight)       )
              for edge in edges:
                   A__			,				A__			,				A__										=  edge
                   A__										=  union_find.find(UpperCamelCase       )
                   A__										=  union_find.find(UpperCamelCase       )
                   if seta != seta:
                        if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
                             A__										=  [head, tail, weight]

                        if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
                             A__										=  [head, tail, weight]
              for vertex in cheap_edge:
                   if cheap_edge[vertex] != -1:
                        A__			,				A__			,				A__										=  cheap_edge[vertex]
                        if union_find.find(UpperCamelCase       ) != union_find.find(UpperCamelCase       ):
                             union_find.union(UpperCamelCase    ,						UpperCamelCase       )
                             mst_edges.append(cheap_edge[vertex]       )
                             A__										=  num_components - 1
         A__										=  Graph.build(edges=UpperCamelCase       )
         return mst






"""simple docstring"""



import warnings
from collections import OrderedDict
from typing import Mapping

from packaging import version

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


SCREAMING_SNAKE_CASE_					:	Any							  =						logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_					:	Optional[Any]							  =						{
    'nvidia/segformer-b0-finetuned-ade-512-512': (
        'https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512/resolve/main/config.json'
    ),
    # See all SegFormer models at https://huggingface.co/models?filter=segformer
}



class 					a						(       _lowerCamelCase				):



    """simple docstring"""



    UpperCAmelCase						 =					"segformer"

    def __init__(     self: Optional[Any]    ,						UpperCamelCase: Union[str, Any]=3    ,						UpperCamelCase: int=4    ,						UpperCamelCase: int=[2, 2, 2, 2]    ,						UpperCamelCase: List[str]=[8, 4, 2, 1]    ,						UpperCamelCase: List[Any]=[32, 64, 1_60, 2_56]    ,						UpperCamelCase: Any=[7, 3, 3, 3]    ,						UpperCamelCase: Union[str, Any]=[4, 2, 2, 2]    ,						UpperCamelCase: Tuple=[1, 2, 5, 8]    ,						UpperCamelCase: Optional[int]=[4, 4, 4, 4]    ,						UpperCamelCase: Dict="gelu"    ,						UpperCamelCase: Optional[Any]=0.0    ,						UpperCamelCase: List[str]=0.0    ,						UpperCamelCase: Union[str, Any]=0.1    ,						UpperCamelCase: List[Any]=0.02    ,						UpperCamelCase: int=0.1    ,						UpperCamelCase: Optional[int]=1e-6    ,						UpperCamelCase: int=2_56    ,						UpperCamelCase: Union[str, Any]=2_55    ,						**UpperCamelCase: Optional[Any]    ,						):






         """simple docstring"""


         super().__init__(**UpperCamelCase       )

         if "reshape_last_stage" in kwargs and kwargs["reshape_last_stage"] is False:
              warnings.warn(
                  """Reshape_last_stage is set to False in this config. This argument is deprecated and will soon be"""
                  """ removed, as the behaviour will default to that of reshape_last_stage = True."""    ,						UpperCamelCase    ,						)

         A__										=  num_channels
         A__										=  num_encoder_blocks
         A__										=  depths
         A__										=  sr_ratios
         A__										=  hidden_sizes
         A__										=  patch_sizes
         A__										=  strides
         A__										=  mlp_ratios
         A__										=  num_attention_heads
         A__										=  hidden_act
         A__										=  hidden_dropout_prob
         A__										=  attention_probs_dropout_prob
         A__										=  classifier_dropout_prob
         A__										=  initializer_range
         A__										=  drop_path_rate
         A__										=  layer_norm_eps
         A__										=  decoder_hidden_size
         A__										=  kwargs.get("""reshape_last_stage"""    ,						UpperCamelCase       )
         A__										=  semantic_loss_ignore_index



class 					a						(       _lowerCamelCase				):



    """simple docstring"""



    UpperCAmelCase						 =					version.parse("1.11"				)

    @property
    def 				UpperCamelCase	(     self: List[str]       ):






         """simple docstring"""


         return OrderedDict(
             [
                 ("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""}),
             ]       )

    @property
    def 				UpperCamelCase	(     self: int       ):






         """simple docstring"""


         return 1e-4





    @property
    def 				UpperCamelCase	(     self: Optional[int]       ):






         """simple docstring"""


         return 12






