


'''simple docstring'''




class 					a			:
 '''simple docstring'''




 def __init__(    self      )      ->    List[Any]:
    _a					:  Optional[int]						=  0
    _a					:  Tuple						=  0
    _a					:  str						=  {}




 def   __UpperCamelCase   (    self		,      lowerCamelCase_      )      ->    Optional[int]:
    if vertex not in self.adjacency:
       _a					:  List[Any]						=  {}
       self.num_vertices += 1




 def   __UpperCamelCase   (    self		,      lowerCamelCase_		,      lowerCamelCase_		,      lowerCamelCase_      )      ->    Dict:
    self.add_vertex(lowerCamelCase_      )
    self.add_vertex(lowerCamelCase_      )

    if head == tail:
       return

    _a					:  str						=  weight
    _a					:  Any						=  weight




 def   __UpperCamelCase   (    self      )      ->    List[str]:
    _a					:  Union[str, Any]						=  self.get_edges()
    for edge in edges:
       _a		,						_a		,						_a					:  List[Any]						=  edge
       edges.remove((tail, head, weight)      )
    for i in range(len(lowerCamelCase_      )      ):
       _a					:  Optional[int]						=  list(edges[i]      )

    edges.sort(key=lambda lowerCamelCase_      : e[2]      )
    for i in range(len(lowerCamelCase_      ) - 1      ):
       if edges[i][2] >= edges[i + 1][2]:
          _a					:  Optional[int]						=  edges[i][2] + 1
    for edge in edges:
       _a		,						_a		,						_a					:  str						=  edge
       _a					:  List[Any]						=  weight
       _a					:  Optional[int]						=  weight




 def __str__(    self      )      ->    List[str]:
    _a					:  List[str]						=  ''
    for tail in self.adjacency:
       for head in self.adjacency[tail]:
          _a					:  Optional[Any]						=  self.adjacency[head][tail]
          string += F'''{head} -> {tail} == {weight}\n'''
    return string.rstrip('\n'      )




 def   __UpperCamelCase   (    self      )      ->    List[str]:
    _a					:  Tuple						=  []
    for tail in self.adjacency:
       for head in self.adjacency[tail]:
          output.append((tail, head, self.adjacency[head][tail])      )
    return output




 def   __UpperCamelCase   (    self      )      ->    Optional[int]:
    return self.adjacency.keys()




 @staticmethod
 def   __UpperCamelCase   (    lowerCamelCase_=None		,      lowerCamelCase_=None      )      ->    Tuple:
    _a					:  List[Any]						=  Graph()
    if vertices is None:
       _a					:  int						=  []
    if edges is None:
       _a					:  Dict						=  []
    for vertex in vertices:
       g.add_vertex(lowerCamelCase_      )
    for edge in edges:
       g.add_edge(*lowerCamelCase_      )
    return g







 class 					a			:
  '''simple docstring'''




  def __init__(    self      )      ->    List[Any]:
     _a					:  Dict						=  {}
     _a					:  Any						=  {}




  def __len__(    self      )      ->    Optional[Any]:
     return len(self.parent      )




  def   __UpperCamelCase   (    self		,      lowerCamelCase_      )      ->    Any:
     if item in self.parent:
        return self.find(lowerCamelCase_      )

     _a					:  Optional[Any]						=  item
     _a					:  Any						=  0
     return item




  def   __UpperCamelCase   (    self		,      lowerCamelCase_      )      ->    str:
     if item not in self.parent:
        return self.make_set(lowerCamelCase_      )
     if item != self.parent[item]:
        _a					:  Any						=  self.find(self.parent[item]      )
     return self.parent[item]




  def   __UpperCamelCase   (    self		,      lowerCamelCase_		,      lowerCamelCase_      )      ->    Tuple:
     _a					:  str						=  self.find(lowerCamelCase_      )
     _a					:  Optional[int]						=  self.find(lowerCamelCase_      )

     if roota == roota:
        return roota

     if self.rank[roota] > self.rank[roota]:
        _a					:  Tuple						=  roota
        return roota

     if self.rank[roota] < self.rank[roota]:
        _a					:  Optional[Any]						=  roota
        return roota

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





 @staticmethod
 def   __UpperCamelCase   (    lowerCamelCase_      )      ->    str:
    _a					:  str						=  graph.num_vertices

    _a					:  List[str]						=  Graph.UnionFind()
    _a					:  Any						=  []
    while num_components > 1:
       _a					:  Optional[Any]						=  {}
       for vertex in graph.get_vertices():
          _a					:  List[str]						=  -1

       _a					:  str						=  graph.get_edges()
       for edge in edges:
          _a		,						_a		,						_a					:  Tuple						=  edge
          edges.remove((tail, head, weight)      )
       for edge in edges:
          _a		,						_a		,						_a					:  int						=  edge
          _a					:  Any						=  union_find.find(lowerCamelCase_      )
          _a					:  List[str]						=  union_find.find(lowerCamelCase_      )
          if seta != seta:
             if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
                _a					:  Any						=  [head, tail, weight]

             if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
                _a					:  Optional[Any]						=  [head, tail, weight]
       for vertex in cheap_edge:
          if cheap_edge[vertex] != -1:
             _a		,						_a		,						_a					:  Dict						=  cheap_edge[vertex]
             if union_find.find(lowerCamelCase_      ) != union_find.find(lowerCamelCase_      ):
                union_find.union(lowerCamelCase_		,      lowerCamelCase_      )
                mst_edges.append(cheap_edge[vertex]      )
                _a					:  Tuple						=  num_components - 1
    _a					:  Dict						=  Graph.build(edges=lowerCamelCase_      )
    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


UpperCAmelCase_      :		int          =		logging.get_logger(__name__)

UpperCAmelCase_      :		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			(				snake_case__  ):
 '''simple docstring'''




 __lowerCAmelCase						: List[Any]							  =		"""segformer"""




 def __init__(    self		,      lowerCamelCase_=3		,      lowerCamelCase_=4		,      lowerCamelCase_=[2, 2, 2, 2]		,      lowerCamelCase_=[8, 4, 2, 1]		,      lowerCamelCase_=[3_2, 6_4, 1_6_0, 2_5_6]		,      lowerCamelCase_=[7, 3, 3, 3]		,      lowerCamelCase_=[4, 2, 2, 2]		,      lowerCamelCase_=[1, 2, 5, 8]		,      lowerCamelCase_=[4, 4, 4, 4]		,      lowerCamelCase_="gelu"		,      lowerCamelCase_=0.0		,      lowerCamelCase_=0.0		,      lowerCamelCase_=0.1		,      lowerCamelCase_=0.02		,      lowerCamelCase_=0.1		,      lowerCamelCase_=1e-6		,      lowerCamelCase_=2_5_6		,      lowerCamelCase_=2_5_5		,      **lowerCamelCase_		,      )      ->    Union[str, Any]:
    super().__init__(**lowerCamelCase_      )

    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.'		,      lowerCamelCase_		,      )

    _a					:  Union[str, Any]						=  num_channels
    _a					:  Any						=  num_encoder_blocks
    _a					:  Union[str, Any]						=  depths
    _a					:  int						=  sr_ratios
    _a					:  List[str]						=  hidden_sizes
    _a					:  Tuple						=  patch_sizes
    _a					:  Any						=  strides
    _a					:  List[Any]						=  mlp_ratios
    _a					:  str						=  num_attention_heads
    _a					:  str						=  hidden_act
    _a					:  List[Any]						=  hidden_dropout_prob
    _a					:  int						=  attention_probs_dropout_prob
    _a					:  Any						=  classifier_dropout_prob
    _a					:  Optional[Any]						=  initializer_range
    _a					:  int						=  drop_path_rate
    _a					:  int						=  layer_norm_eps
    _a					:  Optional[Any]						=  decoder_hidden_size
    _a					:  int						=  kwargs.get('reshape_last_stage'		,      lowerCamelCase_      )
    _a					:  str						=  semantic_loss_ignore_index







class 					a			(				snake_case__  ):
 '''simple docstring'''




 __lowerCAmelCase						: Any							  =		version.parse("""1.11"""  )




 @property
 def   __UpperCamelCase   (    self      )      ->    Mapping[str, Mapping[int, str]]:
    return OrderedDict(
        [
            ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
        ]      )




 @property
 def   __UpperCamelCase   (    self      )      ->    float:
    return 1e-4




 @property
 def   __UpperCamelCase   (    self      )      ->    int:
    return 1_2


