
'''simple docstring'''
import copy
from typing import Dict

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import CONFIG_MAPPING
from ..bit import BitConfig


lowercase__						=			logging.get_logger(__name__)

lowercase__						=			{
    "google/vit-hybrid-base-bit-384": "https://huggingface.co/vit-hybrid-base-bit-384/resolve/main/config.json",
    # See all ViT hybrid models at https://huggingface.co/models?filter=vit
}






class   snake_case__					(			lowerCamelCase__				):







		"""simple docstring"""

		lowerCamelCase           =	'vit-hybrid'



		def __init__(			self							: int     ,  UpperCamelCase__							: Optional[Any]=None     ,  UpperCamelCase__							: Any=768     ,  UpperCamelCase__							: Optional[int]=12     ,  UpperCamelCase__							: Tuple=12     ,  UpperCamelCase__							: Optional[Any]=3072     ,  UpperCamelCase__							: Any="gelu"     ,  UpperCamelCase__							: List[str]=0.0     ,  UpperCamelCase__							: Optional[Any]=0.0     ,  UpperCamelCase__							: List[str]=0.02     ,  UpperCamelCase__							: Dict=1e-1_2     ,  UpperCamelCase__							: Optional[int]=224     ,  UpperCamelCase__							: Any=1     ,  UpperCamelCase__							: Union[str, Any]=3     ,  UpperCamelCase__							: Union[str, Any]=[1, 1024, 24, 24]     ,  UpperCamelCase__							: Dict=True     ,  **UpperCamelCase__							: Tuple     ,  )	-> Tuple:






				"""simple docstring"""







				super().__init__(**lowercase_			)

				if backbone_config is None:
						logger.info('''`backbone_config` is `None`. Initializing the config with a `BiT` backbone.'''			)
						snake_case     :					Optional[Any]     =	{
						    '''global_padding''': '''same''',
						    '''layer_type''': '''bottleneck''',
						    '''depths''': [3, 4, 9],
						    '''out_features''': ['''stage3'''],
						    '''embedding_dynamic_padding''': True,
						}

				if isinstance(lowercase_     ,  lowercase_			):
						if "model_type" in backbone_config:
								snake_case     :					Dict     =	CONFIG_MAPPING[backbone_config['''model_type''']]
						else:
								logger.info(
								    '''`model_type` is not found in `backbone_config`. Use `Bit` as the backbone configuration class.'''			)
								snake_case     :					Tuple     =	BitConfig
						snake_case     :					Optional[int]     =	backbone_config_class(**lowercase_			)

				snake_case     :					int     =	backbone_featmap_shape
				snake_case     :					int     =	backbone_config
				snake_case     :					Dict     =	hidden_size
				snake_case     :					Any     =	num_hidden_layers
				snake_case     :					List[Any]     =	num_attention_heads
				snake_case     :					Optional[Any]     =	intermediate_size
				snake_case     :					Optional[int]     =	hidden_act
				snake_case     :					int     =	hidden_dropout_prob
				snake_case     :					Optional[Any]     =	attention_probs_dropout_prob
				snake_case     :					Tuple     =	initializer_range
				snake_case     :					str     =	layer_norm_eps
				snake_case     :					str     =	image_size
				snake_case     :					Tuple     =	patch_size
				snake_case     :					Dict     =	num_channels
				snake_case     :					str     =	qkv_bias



		def 			lowerCAmelCase							(			self							: Union[str, Any]			)	-> Dict[str, any]:






				"""simple docstring"""







				snake_case     :					List[Any]     =	copy.deepcopy(self.__dict__			)
				snake_case     :					List[str]     =	self.backbone_config.to_dict()
				snake_case     :					int     =	self.__class__.model_type
				return output




'''simple docstring'''
def       _UpperCamelCase	(					SCREAMING_SNAKE_CASE__   ,					SCREAMING_SNAKE_CASE__ )     ->       int:


		'''simple docstring'''


		snake_case     :					Optional[Any]     =	0
		for ele in arr:
				total_sum += product_sum(SCREAMING_SNAKE_CASE__   ,					depth + 1 ) if isinstance(SCREAMING_SNAKE_CASE__   ,					SCREAMING_SNAKE_CASE__ ) else ele
		return total_sum * depth




def       _UpperCamelCase	(					SCREAMING_SNAKE_CASE__ )     ->       int:


		'''simple docstring'''


		return product_sum(SCREAMING_SNAKE_CASE__   ,					1 )


if __name__ == "__main__":
						import doctest

						doctest.testmod()


