


from queue import PriorityQueue
from typing import Any

import numpy as np







def        _lowerCamelCase(	lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , )						->	Tuple:

		'''simple docstring'''







		for nxt, d in graph[v]:
				if nxt in visited_forward:
						continue
				__lowercase=			cst_fwd.get(lowercase__   , np.inf	)
				__lowercase=			cst_fwd[v] + d
				if new_cost_f < old_cost_f:
						queue.put((new_cost_f, nxt)	)
						__lowercase=			new_cost_f
						__lowercase=			v
				if nxt in visited_backward:
						if cst_fwd[v] + d + cst_bwd[nxt] < shortest_distance:
								__lowercase=			cst_fwd[v] + d + cst_bwd[nxt]
		return shortest_distance







def        _lowerCamelCase(	lowercase__   , lowercase__   , lowercase__   , lowercase__	)						->	int:

		'''simple docstring'''







		__lowercase=			-1

		__lowercase=			set()
		__lowercase=			set()
		__lowercase=			{source: 0}
		__lowercase=			{destination: 0}
		__lowercase=			{source: None}
		__lowercase=			{destination: None}
		__lowercase=			PriorityQueue()
		__lowercase=			PriorityQueue()

		__lowercase=			np.inf

		queue_forward.put((0, source)	)
		queue_backward.put((0, destination)	)

		if source == destination:
				return 0

		while not queue_forward.empty() and not queue_backward.empty():
				__lowercase,							__lowercase=			queue_forward.get()
				visited_forward.add(lowercase__	)

				__lowercase,							__lowercase=			queue_backward.get()
				visited_backward.add(lowercase__	)

				__lowercase=			pass_and_relaxation(
				    lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , )

				__lowercase=			pass_and_relaxation(
				    lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , lowercase__   , )

				if cst_fwd[v_fwd] + cst_bwd[v_bwd] >= shortest_distance:
						break

		if shortest_distance != np.inf:
				__lowercase=			shortest_distance
		return shortest_path_distance


lowerCAmelCase           =		{
    'B': [['C', 1]],
    'C': [['D', 1]],
    'D': [['F', 1]],
    'E': [['B', 1], ['G', 2]],
    'F': [],
    'G': [['F', 1]],
}
lowerCAmelCase           =		{
    'B': [['E', 1]],
    'C': [['B', 1]],
    'D': [['C', 1]],
    'F': [['D', 1], ['G', 1]],
    'E': [[None, np.inf]],
    'G': [['E', 2]],
}

if __name__ == "__main__":
	import doctest

	doctest.testmod()













"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


_snake_case     :		Optional[int]       						= logging.get_logger(__name__)

_snake_case     :		Optional[int]       						= {
    'google/vivit-b-16x2-kinetics400': (
        'https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/config.json'
    ),
    # See all Vivit models at https://huggingface.co/models?filter=vivit
}






class 					_UpperCAmelCase   (	lowercase_ ):
					UpperCamelCase      =							'''vivit'''


					def __init__(					self			:Optional[Any]     ,       __UpperCamelCase			:Dict=2_24     ,       __UpperCamelCase			:int=32     ,       __UpperCamelCase			:Union[str, Any]=[2, 16, 16]     ,       __UpperCamelCase			:Optional[Any]=3     ,       __UpperCamelCase			:Optional[Any]=7_68     ,       __UpperCamelCase			:Any=12     ,       __UpperCamelCase			:List[str]=12     ,       __UpperCamelCase			:List[str]=30_72     ,       __UpperCamelCase			:Any="gelu_fast"     ,       __UpperCamelCase			:List[Any]=0.0     ,       __UpperCamelCase			:str=0.0     ,       __UpperCamelCase			:Dict=0.02     ,       __UpperCamelCase			:Optional[Any]=1e-06     ,       __UpperCamelCase			:Dict=True     ,       **__UpperCamelCase			:Tuple     ,       ):
												A		=  hidden_size
												A		=  num_hidden_layers
												A		=  num_attention_heads
												A		=  intermediate_size
												A		=  hidden_act
												A		=  hidden_dropout_prob
												A		=  attention_probs_dropout_prob
												A		=  initializer_range
												A		=  layer_norm_eps

												A		=  image_size
												A		=  num_frames
												A		=  tubelet_size
												A		=  num_channels
												A		=  qkv_bias

												super().__init__(**__UpperCamelCase		)


