
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
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


_A       =					logging.get_logger(__name__)

_A       =					{
    "facebook/convnext-tiny-224": "https://huggingface.co/facebook/convnext-tiny-224/resolve/main/config.json",
    # See all ConvNeXT models at https://huggingface.co/models?filter=convnext
}







class 	lowerCamelCase						(    A_				,					A_    ):
     UpperCAmelCase__							:				Optional[int] 	=						"convnext"





     def __init__(self :       Union[str, Any]							,       _A :       Any=3							,       _A :       List[Any]=4							,       _A :       str=4							,       _A :       Union[str, Any]=None							,       _A :       str=None							,       _A :       Optional[int]="gelu"							,       _A :       List[str]=0.02							,       _A :       Tuple=1E-12							,       _A :       Union[str, Any]=1E-6							,       _A :       int=0.0							,       _A :       Optional[Any]=2_2_4							,       _A :       Optional[int]=None							,       _A :       Optional[int]=None							,       **_A :       Dict							,       )		->		Any:
         super().__init__(**_A  )

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







class 	lowerCamelCase						(    A_    ):
     UpperCAmelCase__							:				Any 	=						version.parse("1.11"    )





     @property
     def 						UpperCAmelCase(self :       Optional[int]  )		->		Mapping[str, Mapping[int, str]]:
         return OrderedDict(
             [
                 ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
             ]  )





     @property
     def 						UpperCAmelCase(self :       Optional[int]  )		->		float:
         return 1E-5



_A       =					{
    "0": 1,
    "1": 1,
    "2": 2,
    "3": 6,
    "4": 24,
    "5": 1_20,
    "6": 7_20,
    "7": 50_40,
    "8": 4_03_20,
    "9": 36_28_80,
}

_A       =					{1_45: 1_45}

_A       =					{
    1_45: 0,
    1_69: 3,
    3_63_01: 3,
    14_54: 3,
    8_71: 2,
    4_53_61: 2,
    8_72: 2,
}



def 		lowercase_     (  A__						)				->				int:
    """simple docstring"""

    if n in CACHE_SUM_DIGIT_FACTORIALS:
        return CACHE_SUM_DIGIT_FACTORIALS[n]
    snake_case						=   sum(DIGIT_FACTORIALS[let] for let in str(A__						)						)
    snake_case						=   ret
    return ret



def 		lowercase_     (  A__					,						A__ = None						)				->				int:
    """simple docstring"""

    snake_case						=   previous or set()
    if n in CHAIN_LENGTH_CACHE:
        return CHAIN_LENGTH_CACHE[n]
    snake_case						=   sum_digit_factorials(A__						)
    if next_number in previous:
        snake_case						=   0
        return 0
    else:
        previous.add(A__						)
        snake_case						=   1 + chain_length(A__					,						A__						)
        snake_case						=   ret
        return ret



def 		lowercase_     (  A__ = 60					,						A__ = 100_0000						)				->				int:
    """simple docstring"""

    return sum(1 for i in range(1					,						A__						) if chain_length(A__						) == num_terms						)


if __name__ == "__main__":
   print(f"{solution() = }")

