

'''simple docstring'''






from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


lowerCAmelCase__											=	logging.get_logger(__name__)

lowerCAmelCase__											=	{
    '''facebook/convnextv2-tiny-1k-224''': '''https://huggingface.co/facebook/convnextv2-tiny-1k-224/resolve/main/config.json''',
}






class 			lowercase_	(lowerCamelCase__				,       lowerCamelCase__      ):




  """simple docstring"""




  SCREAMING_SNAKE_CASE    :  List[str]							=			'convnextv2'






  def __init__(      self   :     Tuple					,lowercase__   :     Dict=3					,lowercase__   :     int=4					,lowercase__   :     Optional[int]=4					,lowercase__   :     Optional[Any]=None					,lowercase__   :     List[str]=None					,lowercase__   :     Tuple="gelu"					,lowercase__   :     Dict=0.0_2					,lowercase__   :     List[Any]=1e-1_2					,lowercase__   :     Optional[int]=0.0					,lowercase__   :     int=2_2_4					,lowercase__   :     int=None					,lowercase__   :     Tuple=None					,**lowercase__   :     List[str]					,):
   super().__init__(**lowercase__			)

   __lowercase							  = num_channels
   __lowercase							  = patch_size
   __lowercase							  = num_stages
   __lowercase							  = [9_6, 1_9_2, 3_8_4, 7_6_8] if hidden_sizes is None else hidden_sizes
   __lowercase							  = [3, 3, 9, 3] if depths is None else depths
   __lowercase							  = hidden_act
   __lowercase							  = initializer_range
   __lowercase							  = layer_norm_eps
   __lowercase							  = drop_path_rate
   __lowercase							  = image_size
   __lowercase							  = ['''stem'''] + [F"stage{idx}" for idx in range(1					,len(self.depths			) + 1			)]
   __lowercase  ,	__lowercase							  = get_aligned_output_features_output_indices(
       out_features=lowercase__					,out_indices=lowercase__					,stage_names=self.stage_names			)





"""simple docstring"""






import numpy as np

UpperCAmelCase    :     Optional[Any]   						=		[
    ['a', 'b', 'c', 'd', 'e'],
    ['f', 'g', 'h', 'i', 'k'],
    ['l', 'm', 'n', 'o', 'p'],
    ['q', 'r', 's', 't', 'u'],
    ['v', 'w', 'x', 'y', 'z'],
]





class      lowerCamelCase__   :







					"""simple docstring"""


					def __init__(       self    : Union[str, Any]  ):
												'''simple docstring'''






												__UpperCAmelCase   :						List[Any]      							=					np.array(UpperCamelCase  )






					def lowerCamelCase__							(       self    : int ,       UpperCamelCase    : str  ):
												'''simple docstring'''






												__UpperCAmelCase							,__UpperCAmelCase   :						Optional[Any]      							=					np.where(letter == self.SQUARE  )
												__UpperCAmelCase   :						Optional[Any]      							=					np.concatenate([indexa + 1, indexa + 1]  )
												return indexes






					def lowerCamelCase__							(       self    : Any ,       UpperCamelCase    : int ,       UpperCamelCase    : int  ):
												'''simple docstring'''






												__UpperCAmelCase   :						Tuple      							=					self.SQUARE[indexa - 1, indexa - 1]
												return letter






					def lowerCamelCase__							(       self    : Optional[int] ,       UpperCamelCase    : str  ):
												'''simple docstring'''






												__UpperCAmelCase   :						str      							=					message.lower()
												__UpperCAmelCase   :						List[Any]      							=					message.replace(""" """ ,       """"""  )
												__UpperCAmelCase   :						List[Any]      							=					message.replace("""j""" ,       """i"""  )

												__UpperCAmelCase   :						Optional[int]      							=					np.empty((2, len(UpperCamelCase  ))  )
												for letter_index in range(len(UpperCamelCase  )  ):
																			__UpperCAmelCase   :						List[Any]      							=					self.letter_to_numbers(message[letter_index]  )

																			__UpperCAmelCase   :						str      							=					numbers[0]
																			__UpperCAmelCase   :						int      							=					numbers[1]

												__UpperCAmelCase   :						Union[str, Any]      							=					first_step.reshape(2 * len(UpperCamelCase  )  )
												__UpperCAmelCase   :						Optional[Any]      							=					""""""
												for numbers_index in range(len(UpperCamelCase  )  ):
																			__UpperCAmelCase   :						Any      							=					int(second_step[numbers_index * 2]  )
																			__UpperCAmelCase   :						Any      							=					int(second_step[(numbers_index * 2) + 1]  )
																			__UpperCAmelCase   :						str      							=					self.numbers_to_letter(UpperCamelCase ,       UpperCamelCase  )
																			__UpperCAmelCase   :						Optional[Any]      							=					encoded_message + letter

												return encoded_message






					def lowerCamelCase__							(       self    : Optional[int] ,       UpperCamelCase    : str  ):
												'''simple docstring'''






												__UpperCAmelCase   :						Any      							=					message.lower()
												message.replace(""" """ ,       """"""  )
												__UpperCAmelCase   :						int      							=					np.empty(2 * len(UpperCamelCase  )  )
												for letter_index in range(len(UpperCamelCase  )  ):
																			__UpperCAmelCase   :						Any      							=					self.letter_to_numbers(message[letter_index]  )
																			__UpperCAmelCase   :						Any      							=					numbers[0]
																			__UpperCAmelCase   :						Dict      							=					numbers[1]

												__UpperCAmelCase   :						str      							=					first_step.reshape((2, len(UpperCamelCase  ))  )
												__UpperCAmelCase   :						Union[str, Any]      							=					""""""
												for numbers_index in range(len(UpperCamelCase  )  ):
																			__UpperCAmelCase   :						Optional[int]      							=					int(second_step[0, numbers_index]  )
																			__UpperCAmelCase   :						Tuple      							=					int(second_step[1, numbers_index]  )
																			__UpperCAmelCase   :						Tuple      							=					self.numbers_to_letter(UpperCamelCase ,       UpperCamelCase  )
																			__UpperCAmelCase   :						Any      							=					decoded_message + letter

												return decoded_message
