


from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


snake_case_    :      int				    =				logging.get_logger(__name__)

snake_case_    :      Optional[Any]				    =				{
    '''google/vit-base-patch16-224''': '''https://huggingface.co/vit-base-patch16-224/resolve/main/config.json''',
    # See all ViT models at https://huggingface.co/models?filter=vit
}

class     A__				(		_a	):
						UpperCAmelCase   							=    '''vit'''




						def __init__(							self       :   Dict					,     _a       :   List[str]=768					,     _a       :   Optional[Any]=12					,     _a       :   List[Any]=12					,     _a       :   List[str]=3072					,     _a       :   Optional[int]="gelu"					,     _a       :   List[str]=0.0					,     _a       :   Optional[Any]=0.0					,     _a       :   List[str]=0.02					,     _a       :   Union[str, Any]=1E-12					,     _a       :   Optional[Any]=224					,     _a       :   Dict=16					,     _a       :   List[str]=3					,     _a       :   str=True					,     _a       :   int=16					,     **_a       :   Tuple					,     )				->  str:


										"""simple docstring"""





										super().__init__(**__UpperCamelCase	)

										_SCREAMING_SNAKE_CASE      	=hidden_size
										_SCREAMING_SNAKE_CASE      	=num_hidden_layers
										_SCREAMING_SNAKE_CASE      	=num_attention_heads
										_SCREAMING_SNAKE_CASE      	=intermediate_size
										_SCREAMING_SNAKE_CASE      	=hidden_act
										_SCREAMING_SNAKE_CASE      	=hidden_dropout_prob
										_SCREAMING_SNAKE_CASE      	=attention_probs_dropout_prob
										_SCREAMING_SNAKE_CASE      	=initializer_range
										_SCREAMING_SNAKE_CASE      	=layer_norm_eps
										_SCREAMING_SNAKE_CASE      	=image_size
										_SCREAMING_SNAKE_CASE      	=patch_size
										_SCREAMING_SNAKE_CASE      	=num_channels
										_SCREAMING_SNAKE_CASE      	=qkv_bias
										_SCREAMING_SNAKE_CASE      	=encoder_stride

class     A__				(		_a	):
						UpperCAmelCase   							=    version.parse("1.11"	)




						@property
						def 				__UpperCamelCase					(							self       :   Optional[int]	)				->  int:


										"""simple docstring"""





										return OrderedDict(
										    [
										        ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
										    ]	)




						@property
						def 				__UpperCamelCase					(							self       :   int	)				->  Union[str, Any]:


										"""simple docstring"""





										return 1E-4

def 	UpperCamelCase__  (     SCREAMING_SNAKE_CASE_	:	int       )  ->     list:

						# bit count represents no. of bits in the gray code
						if bit_count < 0:
												raise ValueError("""The given input must be positive"""       )

						# get the generated string sequence
						_lowercase					       =					gray_code_sequence_string(SCREAMING_SNAKE_CASE_       )
						#
						# convert them to integers
						for i in range(len(SCREAMING_SNAKE_CASE_       )       ):
												_lowercase					       =					int(sequence[i]		,   2       )

						return sequence




def 	UpperCamelCase__  (     SCREAMING_SNAKE_CASE_	:	int       )  ->     list:

						# The approach is a recursive one
						# Base case achieved when either n = 0 or n=1
						if bit_count == 0:
												return ["0"]

						if bit_count == 1:
												return ["0", "1"]

						_lowercase					       =					1 << bit_count  # defines the length of the sequence
						# 1<< n is equivalent to 2^n

						# recursive answer will generate answer for n-1 bits
						_lowercase					       =					gray_code_sequence_string(bit_count - 1       )

						_lowercase					       =					[]

						# append 0 to first half of the smaller sequence generated
						for i in range(seq_len // 2       ):
												_lowercase					       =					"""0""" + smaller_sequence[i]
												sequence.append(SCREAMING_SNAKE_CASE_       )

						# append 1 to second half ... start from the end of the list
						for i in reversed(range(seq_len // 2       )       ):
												_lowercase					       =					"""1""" + smaller_sequence[i]
												sequence.append(SCREAMING_SNAKE_CASE_       )

						return sequence


if __name__ == "__main__":
		import doctest

		doctest.testmod()