






'''simple docstring'''





import copy

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


_a    :   Optional[Any]        =			logging.get_logger(__name__)

_a    :   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__		):




      """simple docstring"""



      A          =    '''dpt'''
      def __init__(   self    ,	_lowerCAmelCase=768    ,	_lowerCAmelCase=12    ,	_lowerCAmelCase=12    ,	_lowerCAmelCase=3_072    ,	_lowerCAmelCase="gelu"    ,	_lowerCAmelCase=0.0    ,	_lowerCAmelCase=0.0    ,	_lowerCAmelCase=0.02    ,	_lowerCAmelCase=1e-12    ,	_lowerCAmelCase=384    ,	_lowerCAmelCase=16    ,	_lowerCAmelCase=3    ,	_lowerCAmelCase=False    ,	_lowerCAmelCase=True    ,	_lowerCAmelCase=[2, 5, 8, 11]    ,	_lowerCAmelCase="project"    ,	_lowerCAmelCase=[4, 2, 1, 0.5]    ,	_lowerCAmelCase=[96, 192, 384, 768]    ,	_lowerCAmelCase=256    ,	_lowerCAmelCase=-1    ,	_lowerCAmelCase=False    ,	_lowerCAmelCase=True    ,	_lowerCAmelCase=0.4    ,	_lowerCAmelCase=255    ,	_lowerCAmelCase=0.1    ,	_lowerCAmelCase=[1, 1_024, 24, 24]    ,	_lowerCAmelCase=[0, 1]    ,	_lowerCAmelCase=None    ,	**_lowerCAmelCase    ,	):



          '''simple docstring'''
          super().__init__(**__A		)

          lowerCAmelCase__   :int      							=				hidden_size
          lowerCAmelCase__   :str      							=				is_hybrid

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

              lowerCAmelCase__   :Any      							=				backbone_featmap_shape
              lowerCAmelCase__   :int      							=				neck_ignore_stages

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

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



      def 			snake_case_      (   self		):



          '''simple docstring'''
          lowerCAmelCase__   :List[str]      							=				copy.deepcopy(self.__dict__		)

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

          lowerCAmelCase__   :Dict      							=				self.__class__.model_type
          return output











def 				snake_case__							(							UpperCAmelCase							:  float    ,			UpperCAmelCase							:  list[float]       ):
    if discount_rate < 0:
        raise ValueError("Discount rate cannot be negative"       )
    if not cash_flows:
        raise ValueError("Cash flows list cannot be empty"       )
    lowerCAmelCase__   :List[Any]      							=				sum(
        cash_flow / ((1 + discount_rate) ** i) for i, cash_flow in enumerate(UpperCAmelCase       )       )
    return round(UpperCAmelCase    ,			ndigits=2       )


if __name__ == "__main__":
 import doctest

 doctest.testmod()



