



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


UpperCAmelCase      :							Dict							       =logging.get_logger(__name__)

UpperCAmelCase      :							str							       ={
    "shi-labs/nat-mini-in1k-224": "https://huggingface.co/shi-labs/nat-mini-in1k-224/resolve/main/config.json",
    # See all Nat models at https://huggingface.co/models?filter=nat
}


class 					_lowercase      (a_					,      a_					):
				'''simple docstring'''







				lowercase__        =  """nat"""

				lowercase__        =  {
				    """num_attention_heads""": """num_heads""",
				    """num_hidden_layers""": """num_layers""",
				}

				def __init__(       self   ,       snake_case__=4   ,       snake_case__=3   ,       snake_case__=64   ,       snake_case__=[3, 4, 6, 5]   ,       snake_case__=[2, 4, 8, 16]   ,       snake_case__=7   ,       snake_case__=3.0   ,       snake_case__=True   ,       snake_case__=0.0   ,       snake_case__=0.0   ,       snake_case__=0.1   ,       snake_case__="gelu"   ,       snake_case__=0.02   ,       snake_case__=1e-5   ,       snake_case__=0.0   ,       snake_case__=None   ,       snake_case__=None   ,       **snake_case__   ,       ):

									'''simple docstring'''


									super().__init__(**snake_case__			)

									UpperCamelCase_						     =      patch_size
									UpperCamelCase_						     =      num_channels
									UpperCamelCase_						     =      embed_dim
									UpperCamelCase_						     =      depths
									UpperCamelCase_						     =      len(snake_case__			)
									UpperCamelCase_						     =      num_heads
									UpperCamelCase_						     =      kernel_size
									UpperCamelCase_						     =      mlp_ratio
									UpperCamelCase_						     =      qkv_bias
									UpperCamelCase_						     =      hidden_dropout_prob
									UpperCamelCase_						     =      attention_probs_dropout_prob
									UpperCamelCase_						     =      drop_path_rate
									UpperCamelCase_						     =      hidden_act
									UpperCamelCase_						     =      layer_norm_eps
									UpperCamelCase_						     =      initializer_range
									# we set the hidden_size attribute in order to make Nat work with VisionEncoderDecoderModel
									# this indicates the channel dimension after the last stage of the model
									UpperCamelCase_						     =      int(embed_dim * 2 ** (len(snake_case__			) - 1)			)
									UpperCamelCase_						     =      layer_scale_init_value
									UpperCamelCase_						     =      ["stem"] + [F"""stage{idx}""" for idx in range(1   ,       len(snake_case__			) + 1			)]
									UpperCamelCase_     ,			UpperCamelCase_						     =      get_aligned_output_features_output_indices(
									    out_features=snake_case__   ,       out_indices=snake_case__   ,       stage_names=self.stage_names			)






def 		__A		(	__lowerCamelCase    )      ->       int:
	a										=							hex_num.strip()
	if not hex_num:
		raise ValueError("""No value was passed to the function"""    )

	a										=							hex_num[0] == """-"""
	if is_negative:
		a										=							hex_num[1:]

	try:
		a										=							int(__lowerCamelCase							,			16    )
	except ValueError:
		raise ValueError("""Invalid value was passed to the function"""    )

	a										=							""""""
	while int_num > 0:
		a										=							str(int_num % 2    ) + bin_str
		int_num >>= 1

	return int(("""-""" + bin_str) if is_negative else bin_str    )


if __name__ == "__main__":
		import doctest

		doctest.testmod()

