


'''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 						_snake_case   (       __lowercase		):
					lowerCAmelCase :Optional[int]						=   '''mctct'''




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

								# prevents config testing fail with exporting to json
								UpperCAmelCase__					:   List[str]       				=       list(_lowerCamelCase)
								UpperCAmelCase__					:   List[str]       				=       list(_lowerCamelCase)

								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 unittest

from .lib import (
    Matrix,
    Vector,
    axpy,
    square_zero_matrix,
    unit_basis_vector,
    zero_vector,
)


class 						_snake_case   (       unittest.TestCase		):




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   str       				=       Vector([1, 2, 3])
								self.assertEqual(x.component(0)							,							1)
								self.assertEqual(x.component(2)							,							3)
								UpperCAmelCase__					:   List[str]       				=       Vector()




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   Any       				=       Vector([0, 0, 0, 0, 0, 1])
								self.assertEqual(str(_lowerCamelCase)							,							"""(0,0,0,0,0,1)""")




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   Optional[int]       				=       Vector([1, 2, 3, 4])
								self.assertEqual(len(_lowerCamelCase)							,							4)




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   List[str]       				=       Vector([1, 2])
								UpperCAmelCase__					:   Optional[int]       				=       Vector([1, 2, 3, 4, 5])
								UpperCAmelCase__					:   Optional[Any]       				=       Vector([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
								UpperCAmelCase__					:   Union[str, Any]       				=       Vector([1, -1, 1, -1, 2, -3, 4, -5])
								self.assertAlmostEqual(x.euclidean_length()							,							2.236							,							3)
								self.assertAlmostEqual(y.euclidean_length()							,							7.416							,							3)
								self.assertEqual(z.euclidean_length()							,							0)
								self.assertAlmostEqual(w.euclidean_length()							,							7.616							,							3)




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   int       				=       Vector([1, 2, 3])
								UpperCAmelCase__					:   Optional[Any]       				=       Vector([1, 1, 1])
								self.assertEqual((x + y).component(0)							,							2)
								self.assertEqual((x + y).component(1)							,							3)
								self.assertEqual((x + y).component(2)							,							4)




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   Optional[int]       				=       Vector([1, 2, 3])
								UpperCAmelCase__					:   Dict       				=       Vector([1, 1, 1])
								self.assertEqual((x - y).component(0)							,							0)
								self.assertEqual((x - y).component(1)							,							1)
								self.assertEqual((x - y).component(2)							,							2)




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   Tuple       				=       Vector([1, 2, 3])
								UpperCAmelCase__					:   Optional[int]       				=       Vector([2, -1, 4])  # for test of dot product
								UpperCAmelCase__					:   Any       				=       Vector([1, -2, -1])
								self.assertEqual(str(x * 3.0)							,							"""(3.0,6.0,9.0)""")
								self.assertEqual((a * b)							,							0)




					def 			snake_case__  ( self):
								self.assertEqual(str(zero_vector(10)).count("""0""")							,							10)




					def 			snake_case__  ( self):
								self.assertEqual(str(unit_basis_vector(3							,							1))							,							"""(0,1,0)""")




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   Any       				=       Vector([1, 2, 3])
								UpperCAmelCase__					:   List[str]       				=       Vector([1, 0, 1])
								self.assertEqual(str(axpy(2							,							_lowerCamelCase							,							_lowerCamelCase))							,							"""(3,4,7)""")




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   Optional[int]       				=       Vector([1, 0, 0, 0, 0, 0])
								UpperCAmelCase__					:   Optional[int]       				=       x.copy()
								self.assertEqual(str(_lowerCamelCase)							,							str(_lowerCamelCase))




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   str       				=       Vector([1, 0, 0])
								x.change_component(0							,							0)
								x.change_component(1							,							1)
								self.assertEqual(str(_lowerCamelCase)							,							"""(0,1,0)""")




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   str       				=       Matrix([[1, 2, 3], [2, 4, 5], [6, 7, 8]]							,							3							,							3)
								self.assertEqual("""|1,2,3|\n|2,4,5|\n|6,7,8|\n"""							,							str(_lowerCamelCase))




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   List[str]       				=       Matrix([[1, 2, 3], [2, 4, 5], [6, 7, 8]]							,							3							,							3)
								UpperCAmelCase__					:   Dict       				=       [[-3, -14, -10], [-5, -10, -5], [-2, -1, 0]]
								for x in range(a.height()):
											for y in range(a.width()):
														self.assertEqual(minors[x][y]							,							a.minor(_lowerCamelCase							,							_lowerCamelCase))




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   Any       				=       Matrix([[1, 2, 3], [2, 4, 5], [6, 7, 8]]							,							3							,							3)
								UpperCAmelCase__					:   Tuple       				=       [[-3, 14, -10], [5, -10, 5], [-2, 1, 0]]
								for x in range(a.height()):
											for y in range(a.width()):
														self.assertEqual(cofactors[x][y]							,							a.cofactor(_lowerCamelCase							,							_lowerCamelCase))




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   Any       				=       Matrix([[1, 2, 3], [2, 4, 5], [6, 7, 8]]							,							3							,							3)
								self.assertEqual(-5							,							a.determinant())




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   str       				=       Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]]							,							3							,							3)
								UpperCAmelCase__					:   List[Any]       				=       Vector([1, 2, 3])
								self.assertEqual("""(14,32,50)"""							,							str(a * x))
								self.assertEqual("""|2,4,6|\n|8,10,12|\n|14,16,18|\n"""							,							str(a * 2))




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   Union[str, Any]       				=       Matrix([[1, 2, 3], [2, 4, 5], [6, 7, 8]]							,							3							,							3)
								a.change_component(0							,							2							,							5)
								self.assertEqual("""|1,2,5|\n|2,4,5|\n|6,7,8|\n"""							,							str(_lowerCamelCase))




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   Any       				=       Matrix([[1, 2, 3], [2, 4, 5], [6, 7, 8]]							,							3							,							3)
								self.assertEqual(7							,							a.component(2							,							1)							,							0.01)




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   str       				=       Matrix([[1, 2, 3], [2, 4, 5], [6, 7, 8]]							,							3							,							3)
								UpperCAmelCase__					:   List[Any]       				=       Matrix([[1, 2, 7], [2, 4, 5], [6, 7, 10]]							,							3							,							3)
								self.assertEqual("""|2,4,10|\n|4,8,10|\n|12,14,18|\n"""							,							str(a + b))




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   List[Any]       				=       Matrix([[1, 2, 3], [2, 4, 5], [6, 7, 8]]							,							3							,							3)
								UpperCAmelCase__					:   Dict       				=       Matrix([[1, 2, 7], [2, 4, 5], [6, 7, 10]]							,							3							,							3)
								self.assertEqual("""|0,0,-4|\n|0,0,0|\n|0,0,-2|\n"""							,							str(a - b))




					def 			snake_case__  ( self):
								self.assertEqual(
								    """|0,0,0,0,0|\n|0,0,0,0,0|\n|0,0,0,0,0|\n|0,0,0,0,0|\n|0,0,0,0,0|\n"""							,							str(square_zero_matrix(5))							,							)


if __name__ == "__main__":
		unittest.main()