

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


lowerCAmelCase							:  str            =						logging.get_logger(__name__)

lowerCAmelCase							:  List[str]            =						{
    """google/vit-base-patch16-224""": """https://huggingface.co/vit-base-patch16-224/resolve/main/config.json""",
    # See all ViT models at https://huggingface.co/models?filter=vit
}



class   __lowercase    (			UpperCAmelCase_     ):




			"""simple docstring"""







			_UpperCAmelCase       :							Union[str, Any]      							=					'''vit'''



			def __init__(			self  :					Optional[int]       ,						lowerCAmelCase__  :					int=768       ,						lowerCAmelCase__  :					List[str]=12       ,						lowerCAmelCase__  :					List[Any]=12       ,						lowerCAmelCase__  :					str=3072       ,						lowerCAmelCase__  :					List[str]="gelu"       ,						lowerCAmelCase__  :					Union[str, Any]=0.0       ,						lowerCAmelCase__  :					Dict=0.0       ,						lowerCAmelCase__  :					int=0.02       ,						lowerCAmelCase__  :					str=1E-12       ,						lowerCAmelCase__  :					Dict=224       ,						lowerCAmelCase__  :					Dict=16       ,						lowerCAmelCase__  :					List[Any]=3       ,						lowerCAmelCase__  :					int=True       ,						lowerCAmelCase__  :					int=16       ,						**lowerCAmelCase__  :					Optional[Any]       ,						):
									super().__init__(**lowerCAmelCase__)

									SCREAMING_SNAKE_CASE_:			Union[str, Any]  		=	hidden_size
									SCREAMING_SNAKE_CASE_:			Optional[int]  		=	num_hidden_layers
									SCREAMING_SNAKE_CASE_:			Dict  		=	num_attention_heads
									SCREAMING_SNAKE_CASE_:			Tuple  		=	intermediate_size
									SCREAMING_SNAKE_CASE_:			List[Any]  		=	hidden_act
									SCREAMING_SNAKE_CASE_:			str  		=	hidden_dropout_prob
									SCREAMING_SNAKE_CASE_:			Any  		=	attention_probs_dropout_prob
									SCREAMING_SNAKE_CASE_:			Union[str, Any]  		=	initializer_range
									SCREAMING_SNAKE_CASE_:			str  		=	layer_norm_eps
									SCREAMING_SNAKE_CASE_:			Dict  		=	image_size
									SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	patch_size
									SCREAMING_SNAKE_CASE_:			Union[str, Any]  		=	num_channels
									SCREAMING_SNAKE_CASE_:			Optional[int]  		=	qkv_bias
									SCREAMING_SNAKE_CASE_:			List[str]  		=	encoder_stride







class   __lowercase    (			UpperCAmelCase_     ):




			"""simple docstring"""







			_UpperCAmelCase       :							List[str]      							=					version.parse('''1.11'''     )



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




			@property
			def 	_SCREAMING_SNAKE_CASE      (			self  :					Optional[int]):
									return 1E-4









from __future__ import annotations

from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass



@dataclass
class   __lowercase    :




			"""simple docstring"""







			_UpperCAmelCase       :							int
			_UpperCAmelCase       :							int







class   __lowercase    :




			"""simple docstring"""







			def __init__(			self  :					Any       ,						lowerCAmelCase__  :					int):
									SCREAMING_SNAKE_CASE_:			list[list[Edge]]  		=	[[] for _ in range(lowerCAmelCase__)]
									SCREAMING_SNAKE_CASE_:			Dict  		=	size



			def __getitem__(			self  :					Dict       ,						lowerCAmelCase__  :					int):
									return iter(self._graph[vertex])



			@property
			def 	_SCREAMING_SNAKE_CASE      (			self  :					Tuple):
									return self._size



			def 	_SCREAMING_SNAKE_CASE      (			self  :					Dict       ,						lowerCAmelCase__  :					int       ,						lowerCAmelCase__  :					int       ,						lowerCAmelCase__  :					int):
									if weight not in (0, 1):
															raise ValueError("Edge weight must be either 0 or 1.")

									if to_vertex < 0 or to_vertex >= self.size:
															raise ValueError("Vertex indexes must be in [0; size).")

									self._graph[from_vertex].append(Edge(lowerCAmelCase__       ,						lowerCAmelCase__))




			def 	_SCREAMING_SNAKE_CASE      (			self  :					List[Any]       ,						lowerCAmelCase__  :					int       ,						lowerCAmelCase__  :					int):
									SCREAMING_SNAKE_CASE_:			Optional[int]  		=	deque([start_vertex])
									SCREAMING_SNAKE_CASE_:			list[int | None]  		=	[None] * self.size
									SCREAMING_SNAKE_CASE_:			List[Any]  		=	0

									while queue:
															SCREAMING_SNAKE_CASE_:			int  		=	queue.popleft()
															SCREAMING_SNAKE_CASE_:			str  		=	distances[current_vertex]
															if current_distance is None:
																					continue

															for edge in self[current_vertex]:
																					SCREAMING_SNAKE_CASE_:			Optional[int]  		=	current_distance + edge.weight
																					SCREAMING_SNAKE_CASE_:			str  		=	distances[edge.destination_vertex]
																					if (
																					    isinstance(lowerCAmelCase__       ,						lowerCAmelCase__)
																					    and new_distance >= dest_vertex_distance
																					):
																											continue
																					SCREAMING_SNAKE_CASE_:			Any  		=	new_distance
																					if edge.weight == 0:
																											queue.appendleft(edge.destination_vertex)
																					else:
																											queue.append(edge.destination_vertex)

									if distances[finish_vertex] is None:
															raise ValueError("No path from start_vertex to finish_vertex.")

									return distances[finish_vertex]


if __name__ == "__main__":
						import doctest

						doctest.testmod()






