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


SCREAMING_SNAKE_CASE		:     str         =	logging.get_logger(__name__)

SCREAMING_SNAKE_CASE		:     int         =	{
    "speechbrain/m-ctc-t-large": "https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json",
    # See all M-CTC-T models at https://huggingface.co/models?filter=mctct
}

class        UpperCamelCase						(				__a				):
						a__		:Tuple      =			'''mctct'''





						def __init__(self			,     __UpperCamelCase=8_065			,     __UpperCamelCase=1_536			,     __UpperCamelCase=36			,     __UpperCamelCase=6_144			,     __UpperCamelCase=4			,     __UpperCamelCase=384			,     __UpperCamelCase=920			,     __UpperCamelCase=1E-5			,     __UpperCamelCase=0.3			,     __UpperCamelCase="relu"			,     __UpperCamelCase=0.02			,     __UpperCamelCase=0.3			,     __UpperCamelCase=0.3			,     __UpperCamelCase=1			,     __UpperCamelCase=0			,     __UpperCamelCase=2			,     __UpperCamelCase=1			,     __UpperCamelCase=0.3			,     __UpperCamelCase=1			,     __UpperCamelCase=(7,)			,     __UpperCamelCase=(3,)			,     __UpperCamelCase=80			,     __UpperCamelCase=1			,     __UpperCamelCase=None			,     __UpperCamelCase="sum"			,     __UpperCamelCase=False			,     **__UpperCamelCase			,     )				->				int:
												super().__init__(**__UpperCamelCase			,     pad_token_id=__UpperCamelCase			,     bos_token_id=__UpperCamelCase			,     eos_token_id=__UpperCamelCase						)
												UpperCamelCase_		:							List[str]  =		vocab_size
												UpperCamelCase_		:							Optional[int]  =		hidden_size
												UpperCamelCase_		:							str  =		num_hidden_layers
												UpperCamelCase_		:							List[Any]  =		intermediate_size
												UpperCamelCase_		:							List[str]  =		num_attention_heads
												UpperCamelCase_		:							Any  =		attention_head_dim
												UpperCamelCase_		:							List[str]  =		max_position_embeddings
												UpperCamelCase_		:							Dict  =		layer_norm_eps
												UpperCamelCase_		:							Optional[Any]  =		layerdrop
												UpperCamelCase_		:							int  =		hidden_act
												UpperCamelCase_		:							Any  =		initializer_range
												UpperCamelCase_		:							Optional[int]  =		hidden_dropout_prob
												UpperCamelCase_		:							int  =		attention_probs_dropout_prob
												UpperCamelCase_		:							List[Any]  =		pad_token_id
												UpperCamelCase_		:							Tuple  =		bos_token_id
												UpperCamelCase_		:							Dict  =		eos_token_id
												UpperCamelCase_		:							Dict  =		conv_glu_dim
												UpperCamelCase_		:							List[str]  =		conv_dropout
												UpperCamelCase_		:							Any  =		num_conv_layers
												UpperCamelCase_		:							Dict  =		input_feat_per_channel
												UpperCamelCase_		:							Dict  =		input_channels
												UpperCamelCase_		:							Tuple  =		conv_channels
												UpperCamelCase_		:							Dict  =		ctc_loss_reduction
												UpperCamelCase_		:							Union[str, Any]  =		ctc_zero_infinity

												# prevents config testing fail with exporting to json
												UpperCamelCase_		:							Dict  =		list(__UpperCamelCase						)
												UpperCamelCase_		:							Any  =		list(__UpperCamelCase						)

												if len(self.conv_kernel						) != self.num_conv_layers:
																		raise ValueError(
																		    """Configuration for convolutional module is incorrect. """
																		    """It is required that `len(config.conv_kernel)` == `config.num_conv_layers` """
																		    f'''but is `len(config.conv_kernel) = {len(self.conv_kernel						)}`, '''
																		    f'''`config.num_conv_layers = {self.num_conv_layers}`.'''						)







from heapq import heappop, heappush

import numpy as np






def     lowerCAmelCase_			(   _SCREAMING_SNAKE_CASE     :				np.ndarray		, _SCREAMING_SNAKE_CASE     :				tuple[int, int]		, _SCREAMING_SNAKE_CASE     :				tuple[int, int]		, _SCREAMING_SNAKE_CASE     :				bool		, ):
						UpperCamelCase_,UpperCamelCase_		:							Union[str, Any]  =		grid.shape
						UpperCamelCase_		:							List[str]  =		[-1, 1, 0, 0]
						UpperCamelCase_		:							Dict  =		[0, 0, -1, 1]
						if allow_diagonal:
												dx += [-1, -1, 1, 1]
												dy += [-1, 1, -1, 1]

						UpperCamelCase_,UpperCamelCase_		:							List[Any]  =		[(0, source)], set()
						UpperCamelCase_		:							Any  =		np.full((rows, cols)		, np.inf			)
						UpperCamelCase_		:							List[str]  =		0
						UpperCamelCase_		:							Union[str, Any]  =		np.empty((rows, cols)		, dtype=_SCREAMING_SNAKE_CASE			)
						UpperCamelCase_		:							Optional[int]  =		None

						while queue:
												((UpperCamelCase_),(UpperCamelCase_))		:							Any  =		heappop(_SCREAMING_SNAKE_CASE			)
												if (x, y) in visited:
																		continue
												visited.add((x, y)			)

												if (x, y) == destination:
																		UpperCamelCase_		:							Tuple  =		[]
																		while (x, y) != source:
																								path.append((x, y)			)
																								UpperCamelCase_,UpperCamelCase_		:							Union[str, Any]  =		predecessors[x, y]
																		path.append(_SCREAMING_SNAKE_CASE			)  # add the source manually
																		path.reverse()
																		return matrix[destination], path

												for i in range(len(_SCREAMING_SNAKE_CASE			)			):
																		UpperCamelCase_,UpperCamelCase_		:							Optional[Any]  =		x + dx[i], y + dy[i]
																		if 0 <= nx < rows and 0 <= ny < cols:
																								UpperCamelCase_		:							Union[str, Any]  =		grid[nx][ny]
																								if next_node == 1 and matrix[nx, ny] > dist + 1:
																														heappush(_SCREAMING_SNAKE_CASE		, (dist + 1, (nx, ny))			)
																														UpperCamelCase_		:							Optional[Any]  =		dist + 1
																														UpperCamelCase_		:							List[Any]  =		(x, y)

						return np.inf, []


if __name__ == "__main__":
	import doctest

	doctest.testmod()






