

'''simple docstring'''


import functools
import operator

from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCAmelCase__										= logging.get_logger(__name__)

lowerCAmelCase__										= {
    "asapp/sew-tiny-100k": "https://huggingface.co/asapp/sew-tiny-100k/resolve/main/config.json",
    # See all SEW models at https://huggingface.co/models?filter=sew
}



class 					lowercase						(  a_ ):
							_lowerCamelCase		:      Any=   "sew"


							def __init__(			self    ,			_snake_case=32    ,			_snake_case=768    ,			_snake_case=12    ,			_snake_case=12    ,			_snake_case=3072    ,			_snake_case=2    ,			_snake_case="gelu"    ,			_snake_case=0.1    ,			_snake_case=0.1    ,			_snake_case=0.1    ,			_snake_case=0.0    ,			_snake_case=0.1    ,			_snake_case=0.1    ,			_snake_case=0.02    ,			_snake_case=1e-5    ,			_snake_case="group"    ,			_snake_case="gelu"    ,			_snake_case=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)    ,			_snake_case=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)    ,			_snake_case=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)    ,			_snake_case=False    ,			_snake_case=128    ,			_snake_case=16    ,			_snake_case=True    ,			_snake_case=0.05    ,			_snake_case=10    ,			_snake_case=2    ,			_snake_case=0.0    ,			_snake_case=10    ,			_snake_case=0    ,			_snake_case="mean"    ,			_snake_case=False    ,			_snake_case=False    ,			_snake_case=256    ,			_snake_case=0    ,			_snake_case=1    ,			_snake_case=2    ,			**_snake_case    ,			)							->				Any:
								super().__init__(**_snake_case    ,			pad_token_id=_snake_case    ,			bos_token_id=_snake_case    ,			eos_token_id=_snake_case)
								UpperCAmelCase_		:      str       	=					hidden_size
								UpperCAmelCase_		:      Dict       	=					feat_extract_norm
								UpperCAmelCase_		:      List[Any]       	=					feat_extract_activation
								UpperCAmelCase_		:      Any       	=					list(_snake_case)
								UpperCAmelCase_		:      List[Any]       	=					list(_snake_case)
								UpperCAmelCase_		:      Union[str, Any]       	=					list(_snake_case)
								UpperCAmelCase_		:      Union[str, Any]       	=					conv_bias
								UpperCAmelCase_		:      Union[str, Any]       	=					num_conv_pos_embeddings
								UpperCAmelCase_		:      Tuple       	=					num_conv_pos_embedding_groups
								UpperCAmelCase_		:      Dict       	=					len(self.conv_dim)
								UpperCAmelCase_		:      Tuple       	=					num_hidden_layers
								UpperCAmelCase_		:      Optional[int]       	=					intermediate_size
								UpperCAmelCase_		:      int       	=					squeeze_factor
								UpperCAmelCase_		:      List[str]       	=					hidden_act
								UpperCAmelCase_		:      Optional[int]       	=					num_attention_heads
								UpperCAmelCase_		:      List[Any]       	=					hidden_dropout
								UpperCAmelCase_		:      Tuple       	=					attention_dropout
								UpperCAmelCase_		:      Optional[Any]       	=					activation_dropout
								UpperCAmelCase_		:      Optional[int]       	=					feat_proj_dropout
								UpperCAmelCase_		:      str       	=					final_dropout
								UpperCAmelCase_		:      List[str]       	=					layerdrop
								UpperCAmelCase_		:      Any       	=					layer_norm_eps
								UpperCAmelCase_		:      Tuple       	=					initializer_range
								UpperCAmelCase_		:      Tuple       	=					vocab_size

								if (
								    (len(self.conv_stride) != self.num_feat_extract_layers)
								    or (len(self.conv_kernel) != self.num_feat_extract_layers)
								    or (len(self.conv_dim) != self.num_feat_extract_layers)
								):
									raise ValueError(
									    'Configuration for convolutional layers is incorrect.'
									    'It is required that `len(config.conv_dim)` == `len(config.conv_stride)` == `len(config.conv_kernel)`,'
									    F"""but is `len(config.conv_dim) = {len(self.conv_dim)}`, `len(config.conv_stride)"""
									    F"""= {len(self.conv_stride)}`, `len(config.conv_kernel) = {len(self.conv_kernel)}`.""")

								# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
								UpperCAmelCase_		:      Optional[int]       	=					apply_spec_augment
								UpperCAmelCase_		:      Any       	=					mask_time_prob
								UpperCAmelCase_		:      Optional[Any]       	=					mask_time_length
								UpperCAmelCase_		:      List[Any]       	=					mask_time_min_masks
								UpperCAmelCase_		:      Dict       	=					mask_feature_prob
								UpperCAmelCase_		:      Union[str, Any]       	=					mask_feature_length
								UpperCAmelCase_		:      Optional[Any]       	=					mask_feature_min_masks

								# ctc loss
								UpperCAmelCase_		:      Any       	=					ctc_loss_reduction
								UpperCAmelCase_		:      int       	=					ctc_zero_infinity

								# sequence classification
								UpperCAmelCase_		:      Optional[Any]       	=					use_weighted_layer_sum
								UpperCAmelCase_		:      List[Any]       	=					classifier_proj_size





							@property
							def 						_snake_case							(			self)							->				Optional[int]:
								return functools.reduce(operator.mul    ,			self.conv_stride    ,			1)









'''simple docstring'''


import math



class 					lowercase						:


							def __init__(			self    ,			_snake_case=0)							->				Union[str, Any]:  # a graph with Node 0,1,...,N-1
								UpperCAmelCase_		:      Tuple       	=					n
								UpperCAmelCase_		:      Optional[Any]       	=					[
								    [math.inf for j in range(0    ,			_snake_case)] for i in range(0    ,			_snake_case)
								]  # adjacency matrix for weight
								UpperCAmelCase_		:      Tuple       	=					[
								    [math.inf for j in range(0    ,			_snake_case)] for i in range(0    ,			_snake_case)
								]  # dp[i][j] stores minimum distance from i to j


							def 						_snake_case							(			self    ,			_snake_case    ,			_snake_case    ,			_snake_case)							->				List[Any]:
								UpperCAmelCase_		:      Union[str, Any]       	=					w


							def 						_snake_case							(			self)							->				str:
								for k in range(0    ,			self.n):
									for i in range(0    ,			self.n):
										for j in range(0    ,			self.n):
											UpperCAmelCase_		:      Optional[int]       	=					min(self.dp[i][j]    ,			self.dp[i][k] + self.dp[k][j])





							def 						_snake_case							(			self    ,			_snake_case    ,			_snake_case)							->				str:
								return self.dp[u][v]


if __name__ == "__main__":
						lowerCAmelCase__										= Graph(5)
						graph.add_edge(0, 2, 9)
						graph.add_edge(0, 4, 10)
						graph.add_edge(1, 3, 5)
						graph.add_edge(2, 3, 7)
						graph.add_edge(3, 0, 10)
						graph.add_edge(3, 1, 2)
						graph.add_edge(3, 2, 1)
						graph.add_edge(3, 4, 6)
						graph.add_edge(4, 1, 3)
						graph.add_edge(4, 2, 4)
						graph.add_edge(4, 3, 9)
						graph.floyd_warshall()
						graph.show_min(1, 4)
						graph.show_min(0, 3)






