



'''simple docstring'''



import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..bit import BitConfig


lowerCAmelCase	:		Any				=   logging.get_logger(__name__)

lowerCAmelCase	:		Optional[int]				=   {
    '''Intel/dpt-large''': '''https://huggingface.co/Intel/dpt-large/resolve/main/config.json''',
    # See all DPT models at https://huggingface.co/models?filter=dpt
}






class 					UpperCAmelCase__	(		UpperCamelCase__ ):
					a      :     str        =							"""dpt"""



					def __init__(    self			,				UpperCamelCase=768			,				UpperCamelCase=12			,				UpperCamelCase=12			,				UpperCamelCase=3072			,				UpperCamelCase="gelu"			,				UpperCamelCase=0.0			,				UpperCamelCase=0.0			,				UpperCamelCase=0.02			,				UpperCamelCase=1E-12			,				UpperCamelCase=384			,				UpperCamelCase=16			,				UpperCamelCase=3			,				UpperCamelCase=False			,				UpperCamelCase=True			,				UpperCamelCase=[2, 5, 8, 11]			,				UpperCamelCase="project"			,				UpperCamelCase=[4, 2, 1, 0.5]			,				UpperCamelCase=[96, 192, 384, 768]			,				UpperCamelCase=256			,				UpperCamelCase=-1			,				UpperCamelCase=False			,				UpperCamelCase=True			,				UpperCamelCase=0.4			,				UpperCamelCase=255			,				UpperCamelCase=0.1			,				UpperCamelCase=[1, 1024, 24, 24]			,				UpperCamelCase=[0, 1]			,				UpperCamelCase=None			,				**UpperCamelCase			,				)     ->			Optional[Any]:
						super().__init__(**UpperCamelCase     )

						__lowerCAmelCase												=  hidden_size
						__lowerCAmelCase												=  is_hybrid

						if self.is_hybrid:
							if backbone_config is None:
								logger.info("Initializing the config with a `BiT` backbone."     )
								__lowerCAmelCase												=  {
								    "global_padding": "same",
								    "layer_type": "bottleneck",
								    "depths": [3, 4, 9],
								    "out_features": ["stage1", "stage2", "stage3"],
								    "embedding_dynamic_padding": True,
								}
								__lowerCAmelCase												=  BitConfig(**UpperCamelCase     )
							elif isinstance(UpperCamelCase			,				UpperCamelCase     ):
								logger.info("Initializing the config with a `BiT` backbone."     )
								__lowerCAmelCase												=  BitConfig(**UpperCamelCase     )
							elif isinstance(UpperCamelCase			,				UpperCamelCase     ):
								__lowerCAmelCase												=  backbone_config
							else:
								raise ValueError(
								    F'''backbone_config must be a dictionary or a `PretrainedConfig`, got {backbone_config.__class__}.'''     )

							__lowerCAmelCase												=  backbone_featmap_shape
							__lowerCAmelCase												=  neck_ignore_stages

							if readout_type != "project":
								raise ValueError("Readout type must be 'project' when using `DPT-hybrid` mode."     )
						else:
							__lowerCAmelCase												=  None
							__lowerCAmelCase												=  None
							__lowerCAmelCase												=  []

						__lowerCAmelCase												=  num_hidden_layers
						__lowerCAmelCase												=  num_attention_heads
						__lowerCAmelCase												=  intermediate_size
						__lowerCAmelCase												=  hidden_act
						__lowerCAmelCase												=  hidden_dropout_prob
						__lowerCAmelCase												=  attention_probs_dropout_prob
						__lowerCAmelCase												=  initializer_range
						__lowerCAmelCase												=  layer_norm_eps
						__lowerCAmelCase												=  image_size
						__lowerCAmelCase												=  patch_size
						__lowerCAmelCase												=  num_channels
						__lowerCAmelCase												=  qkv_bias
						__lowerCAmelCase												=  backbone_out_indices
						if readout_type not in ["ignore", "add", "project"]:
							raise ValueError("Readout_type must be one of ['ignore', 'add', 'project']"     )
						__lowerCAmelCase												=  readout_type
						__lowerCAmelCase												=  reassemble_factors
						__lowerCAmelCase												=  neck_hidden_sizes
						__lowerCAmelCase												=  fusion_hidden_size
						__lowerCAmelCase												=  head_in_index
						__lowerCAmelCase												=  use_batch_norm_in_fusion_residual
						# auxiliary head attributes (semantic segmentation)
						__lowerCAmelCase												=  use_auxiliary_head
						__lowerCAmelCase												=  auxiliary_loss_weight
						__lowerCAmelCase												=  semantic_loss_ignore_index
						__lowerCAmelCase												=  semantic_classifier_dropout



					def        UpperCAmelCase_ (    self     )     ->			Any:
						__lowerCAmelCase												=  copy.deepcopy(self.__dict__     )

						if output["backbone_config"] is not None:
							__lowerCAmelCase												=  self.backbone_config.to_dict()

						__lowerCAmelCase												=  self.__class__.model_type
						return output




'''simple docstring'''



from __future__ import annotations



def   __lowerCAmelCase					(							lowerCamelCase   :						list					):






	'''simple docstring'''




	if not nums:
		raise ValueError("List is empty"					)
	return sum(lowerCamelCase					) / len(lowerCamelCase					)


if __name__ == "__main__":
	import doctest

	doctest.testmod()