
"""simple docstring"""







import copy
from typing import Dict, Optional

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING


lowercase_						    =					logging.get_logger(__name__)

lowercase_						    =					{
    "shi-labs/oneformer_ade20k_swin_tiny": (
        "https://huggingface.co/shi-labs/oneformer_ade20k_swin_tiny/blob/main/config.json"
    ),
    # See all OneFormer models at https://huggingface.co/models?filter=oneformer
}



class 		UpperCAmelCase_	(lowerCamelCase_						):
 """simple docstring"""




 UpperCamelCase_						:     int				   =    """oneformer"""
 UpperCamelCase_						:     Tuple				   =    {"""hidden_size""": """hidden_dim"""}




 def __init__( self       : str     ,   a_       : Optional[Dict] = None     ,   a_       : int = 2_55     ,   a_       : int = 1_50     ,   a_       : int = 0.1     ,   a_       : float = 2.0     ,   a_       : float = 5.0     ,   a_       : float = 5.0     ,   a_       : float = 0.5     ,   a_       : float = 0.07     ,   a_       : int = 1_25_44     ,   a_       : float = 3.0     ,   a_       : float = 0.75     ,   a_       : float = 0.02     ,   a_       : float = 1.0     ,   a_       : float = 1E-05     ,   a_       : bool = False     ,   a_       : bool = True     ,   a_       : bool = True     ,   a_       : Optional[list] = [4, 8, 16, 32]     ,   a_       : int = 77     ,   a_       : int = 2_56     ,   a_       : int = 77     ,   a_       : int = 6     ,   a_       : int = 4_94_08     ,   a_       : int = 2     ,   a_       : int = 16     ,   a_       : int = 2_56     ,   a_       : int = 2_56     ,   a_       : int = 2_56     ,   a_       : int = 10_24     ,   a_       : str = "GN"     ,   a_       : int = 6     ,   a_       : int = 10     ,   a_       : bool = True     ,   a_       : int = 8     ,   a_       : float = 0.1     ,   a_       : int = 20_48     ,   a_       : bool = False     ,   a_       : bool = False     ,   a_       : int = 2     ,   a_       : int = 4     ,   **a_       : Any     ,   )->					Any:



      """simple docstring"""

      if backbone_config is None:
           logger.info("""`backbone_config` is unset. Initializing the config with the default `Swin` backbone.""" )
           UpperCAmelCase_						:    Union[str, Any]    					=  CONFIG_MAPPING["""swin"""](
               image_size=2_24     ,   in_channels=3     ,   patch_size=4     ,   embed_dim=96     ,   depths=[2, 2, 6, 2]     ,   num_heads=[3, 6, 12, 24]     ,   window_size=7     ,   drop_path_rate=0.3     ,   use_absolute_embeddings=a_     ,   out_features=["""stage1""", """stage2""", """stage3""", """stage4"""]     ,   )
      elif isinstance(a_     ,   a_ ):
           UpperCAmelCase_						:    Any    					=  backbone_config.get("""model_type""" )
           UpperCAmelCase_						:    Dict    					=  CONFIG_MAPPING[backbone_model_type]
           UpperCAmelCase_						:    int    					=  config_class.from_dict(a_ )

      UpperCAmelCase_						:    Tuple    					=  backbone_config

      UpperCAmelCase_						:    Tuple    					=  ignore_value
      UpperCAmelCase_						:    Dict    					=  num_queries
      UpperCAmelCase_						:    List[str]    					=  no_object_weight
      UpperCAmelCase_						:    Dict    					=  class_weight
      UpperCAmelCase_						:    Optional[Any]    					=  mask_weight
      UpperCAmelCase_						:    Optional[int]    					=  dice_weight
      UpperCAmelCase_						:    Tuple    					=  contrastive_weight
      UpperCAmelCase_						:    int    					=  contrastive_temperature
      UpperCAmelCase_						:    int    					=  train_num_points
      UpperCAmelCase_						:    str    					=  oversample_ratio
      UpperCAmelCase_						:    Any    					=  importance_sample_ratio
      UpperCAmelCase_						:    Dict    					=  init_std
      UpperCAmelCase_						:    List[Any]    					=  init_xavier_std
      UpperCAmelCase_						:    List[str]    					=  layer_norm_eps
      UpperCAmelCase_						:    Optional[int]    					=  is_training
      UpperCAmelCase_						:    Optional[int]    					=  use_auxiliary_loss
      UpperCAmelCase_						:    Dict    					=  output_auxiliary_logits
      UpperCAmelCase_						:    Dict    					=  strides
      UpperCAmelCase_						:    str    					=  task_seq_len
      UpperCAmelCase_						:    Any    					=  text_encoder_width
      UpperCAmelCase_						:    int    					=  text_encoder_context_length
      UpperCAmelCase_						:    List[str]    					=  text_encoder_num_layers
      UpperCAmelCase_						:    List[Any]    					=  text_encoder_vocab_size
      UpperCAmelCase_						:    List[str]    					=  text_encoder_proj_layers
      UpperCAmelCase_						:    List[Any]    					=  text_encoder_n_ctx
      UpperCAmelCase_						:    List[str]    					=  conv_dim
      UpperCAmelCase_						:    str    					=  mask_dim
      UpperCAmelCase_						:    Dict    					=  hidden_dim
      UpperCAmelCase_						:    List[str]    					=  encoder_feedforward_dim
      UpperCAmelCase_						:    Union[str, Any]    					=  norm
      UpperCAmelCase_						:    Tuple    					=  encoder_layers
      UpperCAmelCase_						:    int    					=  decoder_layers
      UpperCAmelCase_						:    Dict    					=  use_task_norm
      UpperCAmelCase_						:    Any    					=  num_attention_heads
      UpperCAmelCase_						:    Union[str, Any]    					=  dropout
      UpperCAmelCase_						:    int    					=  dim_feedforward
      UpperCAmelCase_						:    List[str]    					=  pre_norm
      UpperCAmelCase_						:    List[str]    					=  enforce_input_proj
      UpperCAmelCase_						:    Optional[Any]    					=  query_dec_layers
      UpperCAmelCase_						:    List[str]    					=  common_stride
      UpperCAmelCase_						:    Optional[int]    					=  decoder_layers

      super().__init__(**a_ )






 def   a      ( self       : Optional[Any] )->					Dict[str, any]:



      """simple docstring"""

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



"""simple docstring"""







from math import radians as angle_to_radians
from math import sin

# Acceleration Constant on Earth (unit m/s^2)
lowercase_						    =					9.8_0665




def 			A_			(					lowercase						, lowercase      )     ->							None:


     """simple docstring"""







     if not isinstance(lowercase						, (int, float)      ):
          raise TypeError("""Invalid velocity. Should be a positive number."""      )

     if not isinstance(lowercase						, (int, float)      ):
          raise TypeError("""Invalid angle. Range is 1-90 degrees."""      )

     # Ensure valid angle
     if angle > 90 or angle < 1:
          raise ValueError("""Invalid angle. Range is 1-90 degrees."""      )

     # Ensure valid velocity
     if init_velocity < 0:
          raise ValueError("""Invalid velocity. Should be a positive number."""      )




def 			A_			(					lowercase						, lowercase      )     ->							float:


     """simple docstring"""







     check_args(lowercase						, lowercase      )
     UpperCAmelCase_						:    Any    					=  angle_to_radians(2 * angle      )
     return round(init_velocity**2 * sin(lowercase      ) / g						, 2      )




def 			A_			(					lowercase						, lowercase      )     ->							float:


     """simple docstring"""







     check_args(lowercase						, lowercase      )
     UpperCAmelCase_						:    Union[str, Any]    					=  angle_to_radians(lowercase      )
     return round(init_velocity**2 * sin(lowercase      ) ** 2 / (2 * g)						, 2      )




def 			A_			(					lowercase						, lowercase      )     ->							float:


     """simple docstring"""







     check_args(lowercase						, lowercase      )
     UpperCAmelCase_						:    Optional[int]    					=  angle_to_radians(lowercase      )
     return round(2 * init_velocity * sin(lowercase      ) / g						, 2      )




def 			A_			(					)     ->							None:


     """simple docstring"""







     UpperCAmelCase_					,UpperCAmelCase_						:    Optional[int]    					=  25, 20
     assert horizontal_distance(lowercase						, lowercase      ) == 40.97
     assert max_height(lowercase						, lowercase      ) == 3.73
     assert total_time(lowercase						, lowercase      ) == 1.74


if __name__ == "__main__":
       from doctest import testmod

       testmod()

       # Get input from user
       lowercase_						    =					float(input("Initial Velocity: ").strip())

       # Get input from user
       lowercase_						    =					float(input("angle: ").strip())

       # Print results
       print()
       print("Results: ")
       print(f"""Horizontal Distance: {horizontal_distance(init_vel, angle)!s} [m]""")
       print(f"""Maximum Height: {max_height(init_vel, angle)!s} [m]""")
       print(f"""Total Time: {total_time(init_vel, angle)!s} [s]""")

