




import copy

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


_snake_case										=       logging.get_logger(__name__)

_snake_case										=       {
    "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 						lowercase							(   UpperCamelCase__		):
     _a							 =						"dpt"

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

           _A							:     Any			=						hidden_size
           _A							:     Optional[int]			=						is_hybrid

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

                 _A							:     Any			=						backbone_featmap_shape
                 _A							:     Optional[Any]			=						neck_ignore_stages

                 if readout_type != "project":
                       raise ValueError("""Readout type must be 'project' when using `DPT-hybrid` mode."""				)
           else:
                 _A							:     Tuple			=						None
                 _A							:     Union[str, Any]			=						None
                 _A							:     Dict			=						[]

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



     def 					a__	(  self				)						->							Union[str, Any]:
           _A							:     str			=						copy.deepcopy(self.__dict__				)

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

           _A							:     Tuple			=						self.__class__.model_type
           return output







from math import asin, atan, cos, radians, sin, sqrt, tan

_snake_case										=       6_3_7_8_1_3_7.0
_snake_case										=       6_3_5_6_7_5_2.3_1_4_2_4_5
_snake_case										=       6378137







def 				lowerCAmelCase_	(     snake_case_,snake_case_,snake_case_,snake_case_     ):
      _A							:     Any			=						(AXIS_A - AXIS_B) / AXIS_A
      _A							:     Optional[int]			=						atan((1 - flattening) * tan(radians(snake_case_     )     )     )
      _A							:     List[str]			=						atan((1 - flattening) * tan(radians(snake_case_     )     )     )
      _A							:     Optional[Any]			=						radians(snake_case_     )
      _A							:     str			=						radians(snake_case_     )
      # Equation
      _A							:     Dict			=						sin((phi_a - phi_a) / 2     )
      _A							:     List[str]			=						sin((lambda_a - lambda_a) / 2     )
      # Square both values
      sin_sq_phi *= sin_sq_phi
      sin_sq_lambda *= sin_sq_lambda
      _A							:     Optional[int]			=						sqrt(sin_sq_phi + (cos(snake_case_     ) * cos(snake_case_     ) * sin_sq_lambda)     )
      return 2 * RADIUS * asin(snake_case_     )


if __name__ == "__main__":
  import doctest

  doctest.testmod()

