



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


__a      =				logging.get_logger(__name__)

__a      =				{
    "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 				lowerCamelCase  (			_lowerCAmelCase				):






					'''simple docstring'''





					_A		:			Optional[Any]						=     """mctct"""






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

											# prevents config testing fail with exporting to json
											snake_case_ :Any						=			list(snake_case						)
											snake_case_ :str						=			list(snake_case						)

											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}`."""						)





"""simple docstring"""
import math
class 				lowerCamelCase  :






					'''simple docstring'''





					def    lowerCAmelCase_				(       self:							Tuple						,     snake_case:							list[list[float]]						,     snake_case:							list[int]						)   ->	int:
											snake_case_ :Any						=			0.0
											snake_case_ :Tuple						=			0.0
											for i in range(len(snake_case						)						):
																	da += math.pow((sample[i] - weights[0][i])						,     2						)
																	da += math.pow((sample[i] - weights[1][i])						,     2						)
																	return 0 if da > da else 1
											return 0






					def    lowerCAmelCase_				(       self:							Optional[int]						,     snake_case:							list[list[int | float]]						,     snake_case:							list[int]						,     snake_case:							int						,     snake_case:							float						)   ->	list[list[int | float]]:
											for i in range(len(snake_case						)						):
																	weights[j][i] += alpha * (sample[i] - weights[j][i])
											return weights

def    A_  (			):







						'''simple docstring'''


						snake_case_ :Dict						=			[[1, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 1, 1]]

						# weight initialization ( n, C )
						snake_case_ :List[Any]						=			[[0.2, 0.6, 0.5, 0.9], [0.8, 0.4, 0.7, 0.3]]

						# training
						snake_case_ :Optional[Any]						=			SelfOrganizingMap()
						snake_case_ :Dict						=			3
						snake_case_ :Dict						=			0.5

						for _ in range(_lowercase	):
												for j in range(len(_lowercase	)	):
																		# training sample
																		snake_case_ :List[Any]						=			training_samples[j]

																		# Compute the winning vector
																		snake_case_ :Optional[int]						=			self_organizing_map.get_winner(_lowercase,					_lowercase	)

																		# Update the winning vector
																		snake_case_ :List[str]						=			self_organizing_map.update(_lowercase,					_lowercase,					_lowercase,					_lowercase	)

    # classify test sample
						snake_case_ :str						=			[0, 0, 0, 1]
						snake_case_ :List[Any]						=			self_organizing_map.get_winner(_lowercase,					_lowercase	)

						# results
						print(f"""Clusters that the test sample belongs to : {winner}"""	)
						print(f"""Weights that have been trained : {weights}"""	)


# running the main() function
if __name__ == "__main__":
						main()
