
"""simple docstring"""




class 	lowerCAmelCase_						:


				"""simple docstring"""



				def __init__(self    )					->		Dict:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__						:       Optional[int]           =   0
											SCREAMING_SNAKE_CASE__						:       str           =   0
											SCREAMING_SNAKE_CASE__						:       int           =   {}



				def 	__magic_name__    (self   ,       SCREAMING_SNAKE_CASE__    )					->		Dict:



											"""simple docstring"""




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



				def 	__magic_name__    (self   ,       SCREAMING_SNAKE_CASE__   ,       SCREAMING_SNAKE_CASE__   ,       SCREAMING_SNAKE_CASE__    )					->		Dict:



											"""simple docstring"""




											self.add_vertex(SCREAMING_SNAKE_CASE__    )
											self.add_vertex(SCREAMING_SNAKE_CASE__    )

											if head == tail:
																		return

											SCREAMING_SNAKE_CASE__						:       int           =   weight
											SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   weight



				def 	__magic_name__    (self    )					->		List[str]:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__						:       Any           =   self.get_edges()
											for edge in edges:
																		SCREAMING_SNAKE_CASE__      ,      SCREAMING_SNAKE_CASE__      ,      SCREAMING_SNAKE_CASE__						:       List[Any]           =   edge
																		edges.remove((tail, head, weight)    )
											for i in range(len(SCREAMING_SNAKE_CASE__    )    ):
																		SCREAMING_SNAKE_CASE__						:       List[str]           =   list(edges[i]    )

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



				def __str__(self    )					->		Dict:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__						:       Union[str, Any]           =   """"""
											for tail in self.adjacency:
																		for head in self.adjacency[tail]:
																									SCREAMING_SNAKE_CASE__						:       Union[str, Any]           =   self.adjacency[head][tail]
																									string += F'''{head} -> {tail} == {weight}\n'''
											return string.rstrip("""\n"""    )



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



											"""simple docstring"""




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



				def 	__magic_name__    (self    )					->		List[str]:



											"""simple docstring"""




											return self.adjacency.keys()



				@staticmethod
				def 	__magic_name__    (SCREAMING_SNAKE_CASE__=None   ,       SCREAMING_SNAKE_CASE__=None    )					->		str:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__						:       Any           =   Graph()
											if vertices is None:
																		SCREAMING_SNAKE_CASE__						:       Union[str, Any]           =   []
											if edges is None:
																		SCREAMING_SNAKE_CASE__						:       List[str]           =   []
											for vertex in vertices:
																		g.add_vertex(SCREAMING_SNAKE_CASE__    )
											for edge in edges:
																		g.add_edge(*SCREAMING_SNAKE_CASE__    )
											return g



				class 	lowerCAmelCase_						:


								"""simple docstring"""



								def __init__(self    )					->		List[str]:



															"""simple docstring"""




															SCREAMING_SNAKE_CASE__						:       Dict           =   {}
															SCREAMING_SNAKE_CASE__						:       List[Any]           =   {}



								def __len__(self    )					->		Any:



															"""simple docstring"""




															return len(self.parent    )



								def 	__magic_name__    (self   ,       SCREAMING_SNAKE_CASE__    )					->		Union[str, Any]:



															"""simple docstring"""




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

															SCREAMING_SNAKE_CASE__						:       int           =   item
															SCREAMING_SNAKE_CASE__						:       Dict           =   0
															return item



								def 	__magic_name__    (self   ,       SCREAMING_SNAKE_CASE__    )					->		str:



															"""simple docstring"""




															if item not in self.parent:
																						return self.make_set(SCREAMING_SNAKE_CASE__    )
															if item != self.parent[item]:
																						SCREAMING_SNAKE_CASE__						:       List[Any]           =   self.find(self.parent[item]    )
															return self.parent[item]



								def 	__magic_name__    (self   ,       SCREAMING_SNAKE_CASE__   ,       SCREAMING_SNAKE_CASE__    )					->		Tuple:



															"""simple docstring"""




															SCREAMING_SNAKE_CASE__						:       str           =   self.find(SCREAMING_SNAKE_CASE__    )
															SCREAMING_SNAKE_CASE__						:       List[Any]           =   self.find(SCREAMING_SNAKE_CASE__    )

															if roota == roota:
																						return roota

															if self.rank[roota] > self.rank[roota]:
																						SCREAMING_SNAKE_CASE__						:       str           =   roota
																						return roota

															if self.rank[roota] < self.rank[roota]:
																						SCREAMING_SNAKE_CASE__						:       Union[str, Any]           =   roota
																						return roota

															if self.rank[roota] == self.rank[roota]:
																						self.rank[roota] += 1
																						SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   roota
																						return roota
															return None






				@staticmethod
				def 	__magic_name__    (SCREAMING_SNAKE_CASE__    )					->		Any:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__						:       Any           =   graph.num_vertices

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

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

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






"""simple docstring"""




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__      :    str    							= logging.get_logger(__name__)

UpperCAmelCase__      :    Optional[int]    							= {
    'hustvl/yolos-small': 'https://huggingface.co/hustvl/yolos-small/resolve/main/config.json',
    # See all YOLOS models at https://huggingface.co/models?filter=yolos
}



class 	lowerCAmelCase_						(a__  ):


				"""simple docstring"""



				__UpperCamelCase      :						int					       =   '''yolos'''



				def __init__(self   ,       SCREAMING_SNAKE_CASE__=7_68   ,       SCREAMING_SNAKE_CASE__=12   ,       SCREAMING_SNAKE_CASE__=12   ,       SCREAMING_SNAKE_CASE__=30_72   ,       SCREAMING_SNAKE_CASE__="gelu"   ,       SCREAMING_SNAKE_CASE__=0.0   ,       SCREAMING_SNAKE_CASE__=0.0   ,       SCREAMING_SNAKE_CASE__=0.02   ,       SCREAMING_SNAKE_CASE__=1E-12   ,       SCREAMING_SNAKE_CASE__=[5_12, 8_64]   ,       SCREAMING_SNAKE_CASE__=16   ,       SCREAMING_SNAKE_CASE__=3   ,       SCREAMING_SNAKE_CASE__=True   ,       SCREAMING_SNAKE_CASE__=1_00   ,       SCREAMING_SNAKE_CASE__=True   ,       SCREAMING_SNAKE_CASE__=False   ,       SCREAMING_SNAKE_CASE__=1   ,       SCREAMING_SNAKE_CASE__=5   ,       SCREAMING_SNAKE_CASE__=2   ,       SCREAMING_SNAKE_CASE__=5   ,       SCREAMING_SNAKE_CASE__=2   ,       SCREAMING_SNAKE_CASE__=0.1   ,       **SCREAMING_SNAKE_CASE__   ,       )					->		Optional[Any]:



											"""simple docstring"""




											super().__init__(**SCREAMING_SNAKE_CASE__    )

											SCREAMING_SNAKE_CASE__						:       Optional[int]           =   hidden_size
											SCREAMING_SNAKE_CASE__						:       int           =   num_hidden_layers
											SCREAMING_SNAKE_CASE__						:       str           =   num_attention_heads
											SCREAMING_SNAKE_CASE__						:       List[str]           =   intermediate_size
											SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   hidden_act
											SCREAMING_SNAKE_CASE__						:       List[Any]           =   hidden_dropout_prob
											SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   attention_probs_dropout_prob
											SCREAMING_SNAKE_CASE__						:       Optional[int]           =   initializer_range
											SCREAMING_SNAKE_CASE__						:       Dict           =   layer_norm_eps
											SCREAMING_SNAKE_CASE__						:       List[str]           =   image_size
											SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   patch_size
											SCREAMING_SNAKE_CASE__						:       List[str]           =   num_channels
											SCREAMING_SNAKE_CASE__						:       List[str]           =   qkv_bias
											SCREAMING_SNAKE_CASE__						:       Optional[int]           =   num_detection_tokens
											SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   use_mid_position_embeddings
											SCREAMING_SNAKE_CASE__						:       List[str]           =   auxiliary_loss
											# Hungarian matcher
											SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   class_cost
											SCREAMING_SNAKE_CASE__						:       List[str]           =   bbox_cost
											SCREAMING_SNAKE_CASE__						:       List[Any]           =   giou_cost
											# Loss coefficients
											SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   bbox_loss_coefficient
											SCREAMING_SNAKE_CASE__						:       List[str]           =   giou_loss_coefficient
											SCREAMING_SNAKE_CASE__						:       int           =   eos_coefficient






class 	lowerCAmelCase_						(a__  ):


				"""simple docstring"""



				__UpperCamelCase      :						Dict					       =   version.parse('''1.11'''  )



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



											"""simple docstring"""




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



				@property
				def 	__magic_name__    (self    )					->		float:



											"""simple docstring"""




											return 1E-4



				@property
				def 	__magic_name__    (self    )					->		int:



											"""simple docstring"""




											return 12




