
import os
import string
import sys


snake_case :		Any							      =  1 << 8

snake_case :		Any							      =  {
    "tab": ord("\t"),
    "newline": ord("\r"),
    "esc": 27,
    "up": 65 + ARROW_KEY_FLAG,
    "down": 66 + ARROW_KEY_FLAG,
    "right": 67 + ARROW_KEY_FLAG,
    "left": 68 + ARROW_KEY_FLAG,
    "mod_int": 91,
    "undefined": sys.maxsize,
    "interrupt": 3,
    "insert": 50,
    "delete": 51,
    "pg_up": 53,
    "pg_down": 54,
}

snake_case :		List[str]							      =  KEYMAP["up"]
snake_case :		Dict							      =  KEYMAP["left"]

if sys.platform == "win32":
				snake_case :		Tuple							      =  []
				snake_case :		Optional[int]							      =  {
				    b"\xe0H": KEYMAP["up"] - ARROW_KEY_FLAG,
				    b"\x00H": KEYMAP["up"] - ARROW_KEY_FLAG,
				    b"\xe0P": KEYMAP["down"] - ARROW_KEY_FLAG,
				    b"\x00P": KEYMAP["down"] - ARROW_KEY_FLAG,
				    b"\xe0M": KEYMAP["right"] - ARROW_KEY_FLAG,
				    b"\x00M": KEYMAP["right"] - ARROW_KEY_FLAG,
				    b"\xe0K": KEYMAP["left"] - ARROW_KEY_FLAG,
				    b"\x00K": KEYMAP["left"] - ARROW_KEY_FLAG,
				}

for i in range(10):
				snake_case :		Union[str, Any]							      =  ord(str(i))






def   lowerCAmelCase_						(					)				->		int:







	'''simple docstring'''


	if os.name == "nt":
		import msvcrt

		__magic_name__		:		Tuple	   =     "mbcs"
		# Flush the keyboard buffer
		while msvcrt.kbhit():
			msvcrt.getch()
		if len(A__   ) == 0:
			# Read the keystroke
			__magic_name__		:		Optional[int]	   =     msvcrt.getch()

			# If it is a prefix char, get second part
			if ch in (b"\x00", b"\xe0"):
				__magic_name__		:		List[Any]	   =     ch + msvcrt.getch()
				# Translate actual Win chars to bullet char types
				try:
					__magic_name__		:		Optional[int]	   =     chr(WIN_KEYMAP[cha]   )
					WIN_CH_BUFFER.append(chr(KEYMAP["mod_int"]   )   )
					WIN_CH_BUFFER.append(A__   )
					if ord(A__   ) in (
					    KEYMAP["insert"] - 1 << 9,
					    KEYMAP["delete"] - 1 << 9,
					    KEYMAP["pg_up"] - 1 << 9,
					    KEYMAP["pg_down"] - 1 << 9,
					):
						WIN_CH_BUFFER.append(chr(126   )   )
					__magic_name__		:		List[str]	   =     chr(KEYMAP["esc"]   )
				except KeyError:
					__magic_name__		:		List[str]	   =     cha[1]
			else:
				__magic_name__		:		List[str]	   =     ch.decode(A__   )
		else:
			__magic_name__		:		Tuple	   =     WIN_CH_BUFFER.pop(0   )
	elif os.name == "posix":
		import termios
		import tty

		__magic_name__		:		List[Any]	   =     sys.stdin.fileno()
		__magic_name__		:		Tuple	   =     termios.tcgetattr(A__   )
		try:
			tty.setraw(A__   )
			__magic_name__		:		List[Any]	   =     sys.stdin.read(1   )
		finally:
			termios.tcsetattr(A__      ,   termios.TCSADRAIN      ,   A__   )
	return ch






def   lowerCAmelCase_						(					)				->		Union[str, Any]:







	'''simple docstring'''


	__magic_name__		:		int	   =     get_raw_chars()
	if ord(A__   ) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
		return char

	elif ord(A__   ) == KEYMAP["esc"]:
		__magic_name__		:		Union[str, Any]	   =     get_raw_chars()
		if ord(A__   ) == KEYMAP["mod_int"]:
			__magic_name__		:		List[Any]	   =     get_raw_chars()
			if ord(A__   ) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(A__   ) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
				return chr(ord(A__   ) + ARROW_KEY_FLAG   )
			else:
				return KEYMAP["undefined"]
		else:
			return get_raw_chars()

	else:
		if char in string.printable:
			return char
		else:
			return KEYMAP["undefined"]



'''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			)

