


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


lowerCAmelCase	=							logging.get_logger(__name__)

lowerCAmelCase	=							{
    'naver-clova-ix/donut-base': 'https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json',
    # See all Donut models at https://huggingface.co/models?filter=donut-swin
}


class 	_a							(      UpperCamelCase__      ):
							_lowercase     :      List[Any]  				=			'''donut-swin'''

							_lowercase     :      Union[str, Any]  				=			{
							    '''num_attention_heads''': '''num_heads''',
							    '''num_hidden_layers''': '''num_layers''',
							}

							def __init__(							self:     Union[str, Any]   ,						UpperCamelCase_:     int=224   ,						UpperCamelCase_:     Optional[int]=4   ,						UpperCamelCase_:     Optional[int]=3   ,						UpperCamelCase_:     Union[str, Any]=96   ,						UpperCamelCase_:     Tuple=[2, 2, 6, 2]   ,						UpperCamelCase_:     List[str]=[3, 6, 12, 24]   ,						UpperCamelCase_:     Any=7   ,						UpperCamelCase_:     Optional[Any]=4.0   ,						UpperCamelCase_:     Dict=True   ,						UpperCamelCase_:     Dict=0.0   ,						UpperCamelCase_:     Dict=0.0   ,						UpperCamelCase_:     List[Any]=0.1   ,						UpperCamelCase_:     Tuple="gelu"   ,						UpperCamelCase_:     Optional[Any]=False   ,						UpperCamelCase_:     Optional[Any]=0.02   ,						UpperCamelCase_:     str=1E-5   ,						**UpperCamelCase_:     Dict   ,						)      ->       Optional[Any]:





									"""simple docstring"""







									super().__init__(**UpperCamelCase_							)

									lowercase__						=				image_size
									lowercase__						=				patch_size
									lowercase__						=				num_channels
									lowercase__						=				embed_dim
									lowercase__						=				depths
									lowercase__						=				len(UpperCamelCase_							)
									lowercase__						=				num_heads
									lowercase__						=				window_size
									lowercase__						=				mlp_ratio
									lowercase__						=				qkv_bias
									lowercase__						=				hidden_dropout_prob
									lowercase__						=				attention_probs_dropout_prob
									lowercase__						=				drop_path_rate
									lowercase__						=				hidden_act
									lowercase__						=				use_absolute_embeddings
									lowercase__						=				layer_norm_eps
									lowercase__						=				initializer_range
									# we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
									# this indicates the channel dimension after the last stage of the model
									lowercase__						=				int(embed_dim * 2 ** (len(UpperCamelCase_							) - 1)							)






lowerCAmelCase	=							[sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_0000)]
def       _a			(				SCREAMING_SNAKE_CASE					):


		"""simple docstring"""




		lowercase__						=				0
		while number:
				# Increased Speed Slightly by checking every 5 digits together.
				sum_of_digits_squared += DIGITS_SQUARED[number % 10_00_00]
				number //= 10_00_00

		return sum_of_digits_squared


# There are 2 Chains made,
# One ends with 89 with the chain member 58 being the one which when declared first,
# there will be the least number of iterations for all the members to be checked.

# The other one ends with 1 and has only one element 1.

# So 58 and 1 are chosen to be declared at the starting.

# Changed dictionary to an array to quicken the solution
lowerCAmelCase	=							[None] * 1000_0000
lowerCAmelCase	=							True
lowerCAmelCase	=							False
def       _a			(				SCREAMING_SNAKE_CASE					):


		"""simple docstring"""




		if CHAINS[number - 1] is not None:
				return CHAINS[number - 1]  # type: ignore

		lowercase__						=				chain(next_number(SCREAMING_SNAKE_CASE					)					)
		lowercase__						=				number_chain

		while number < 10_00_00_00:
				lowercase__						=				number_chain
				number *= 10

		return number_chain
def       _a			(				SCREAMING_SNAKE_CASE = 10_00_00_00					):


		"""simple docstring"""




		for i in range(1						,    SCREAMING_SNAKE_CASE					):
				if CHAINS[i] is None:
						chain(i + 1					)

		return CHAINS[:number].count(SCREAMING_SNAKE_CASE					)


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			print(f"""{solution() = }""")


