






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


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

_UpperCAmelCase			:		Optional[Any]   				=    {
    "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_       (				a__					):
							UpperCamelCase_		:str		      =    'mctct'




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

											# prevents config testing fail with exporting to json
											lowerCAmelCase__      			=						list(_A	)
											lowerCAmelCase__      			=						list(_A	)

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













import numpy as np
from cva import destroyAllWindows, imread, imshow, waitKey
class  lowerCAmelCase_       :




							def __init__(   self     :   Union[str, Any] ,							SCREAMING_SNAKE_CASE_     :   Optional[Any] ,							SCREAMING_SNAKE_CASE_     :   int ,							SCREAMING_SNAKE_CASE_     :   int	):
											if dst_width < 0 or dst_height < 0:
															raise ValueError('''Destination width/height should be > 0'''	)

											lowerCAmelCase__      			=						img
											lowerCAmelCase__      			=						img.shape[1]
											lowerCAmelCase__      			=						img.shape[0]
											lowerCAmelCase__      			=						dst_width
											lowerCAmelCase__      			=						dst_height

											lowerCAmelCase__      			=						self.src_w / self.dst_w
											lowerCAmelCase__      			=						self.src_h / self.dst_h

											lowerCAmelCase__      			=						lowerCAmelCase__      			=						(
											    np.ones((self.dst_h, self.dst_w, 3) ,							np.uinta	) * 255
											)




							def 						__snake_case					(   self     :   List[str]	):
											for i in range(self.dst_h	):
															for j in range(self.dst_w	):
																			lowerCAmelCase__      			=						self.img[self.get_y(SCREAMING_SNAKE_CASE_	)][self.get_x(SCREAMING_SNAKE_CASE_	)]




							def 						__snake_case					(   self     :   Any ,							SCREAMING_SNAKE_CASE_     :   int	):
											return int(self.ratio_x * x	)




							def 						__snake_case					(   self     :   List[str] ,							SCREAMING_SNAKE_CASE_     :   int	):
											return int(self.ratio_y * y	)


if __name__ == "__main__":
			_UpperCAmelCase				,   _UpperCAmelCase			:		List[str]   				=    800, 600
			_UpperCAmelCase			:		Tuple   				=    imread("image_data/lena.jpg", 1)
			_UpperCAmelCase			:		str   				=    NearestNeighbour(im, dst_w, dst_h)
			n.process()

			imshow(
			    F'''Image resized from: {im.shape[1]}x{im.shape[0]} to {dst_w}x{dst_h}''', n.output
			)
			waitKey(0)
			destroyAllWindows()





