



from math import radians as angle_to_radians
from math import sin

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





def 				A      (	_UpperCAmelCase							:  Tuple				,  _UpperCAmelCase							:  int       )							->					Optional[int]:







			'''simple docstring'''

			# Ensure valid instance
			if not isinstance(_lowerCamelCase				,  (int, float)       ):
						raise TypeError('Invalid velocity. Should be a positive number.'       )

			if not isinstance(_lowerCamelCase				,  (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      (	_UpperCAmelCase							:  Optional[Any]				,  _UpperCAmelCase							:  Any       )							->					List[Any]:







			'''simple docstring'''
			check_args(_lowerCamelCase				,  _lowerCamelCase       )
			_UpperCAmelCase									=  angle_to_radians(2 * angle       )
			return round(init_velocity**2 * sin(_lowerCamelCase       ) / g				,  2       )





def 				A      (	_UpperCAmelCase							:  int				,  _UpperCAmelCase							:  Tuple       )							->					int:







			'''simple docstring'''
			check_args(_lowerCamelCase				,  _lowerCamelCase       )
			_UpperCAmelCase									=  angle_to_radians(_lowerCamelCase       )
			return round(init_velocity**2 * sin(_lowerCamelCase       ) ** 2 / (2 * g)				,  2       )





def 				A      (	_UpperCAmelCase							:  int				,  _UpperCAmelCase							:  Any       )							->					int:







			'''simple docstring'''
			check_args(_lowerCamelCase				,  _lowerCamelCase       )
			_UpperCAmelCase									=  angle_to_radians(_lowerCamelCase       )
			return round(2 * init_velocity * sin(_lowerCamelCase       ) / g				,  2       )





def 				A      (	)							->					Dict:







			'''simple docstring'''
			_UpperCAmelCase									=  25, 20
			assert horizontal_distance(_lowerCamelCase				,  _lowerCamelCase       ) == 40.97
			assert max_height(_lowerCamelCase				,  _lowerCamelCase       ) == 3.73
			assert total_time(_lowerCamelCase				,  _lowerCamelCase       ) == 1.74


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

							testmod()

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

							# Get input from user
							UpperCAmelCase__  =			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]""")








"""simple docstring"""
import torch.nn as nn

from .imports import is_fpa_available


if is_fpa_available():
      import transformer_engine.pytorch as te






def 			lowerCamelCase_    (		_lowerCamelCase     ,  _lowerCamelCase=True     ,  _lowerCamelCase=True     ,  _lowerCamelCase=True							):
 if not is_fpa_available():
  raise ImportError('Using `convert_model` requires transformer_engine to be installed.'							)
 for name, module in model.named_children():
  if isinstance(_lowerCamelCase     ,  nn.Linear							) and to_transformer_engine and _convert_linear:
   # Return early if the linear layer weights are not multiples of 16
   if any(p % 16 != 0 for p in module.weight.shape							):
    return
   lowerCamelCase__	:     List[Any]								=		module.bias is not None
   lowerCamelCase__	:     Tuple								=		te.Linear(
       module.in_features     ,  module.out_features     ,  bias=_lowerCamelCase     ,  params_dtype=module.weight.dtype							)
   lowerCamelCase__	:     Optional[Any]								=		module.weight.data.clone()
   if has_bias:
    lowerCamelCase__	:     List[str]								=		module.bias.data.clone()

   setattr(_lowerCamelCase     ,  _lowerCamelCase     ,  _lowerCamelCase							)
  elif isinstance(_lowerCamelCase     ,  nn.LayerNorm							) and to_transformer_engine and _convert_ln:
   lowerCamelCase__	:     Tuple								=		te.LayerNorm(module.normalized_shape[0]     ,  eps=module.eps     ,  params_dtype=module.weight.dtype							)
   lowerCamelCase__	:     Tuple								=		module.weight.data.clone()
   lowerCamelCase__	:     Optional[Any]								=		module.bias.data.clone()

   setattr(_lowerCamelCase     ,  _lowerCamelCase     ,  _lowerCamelCase							)
  elif isinstance(_lowerCamelCase     ,  te.Linear							) and not to_transformer_engine and _convert_linear:
   lowerCamelCase__	:     Optional[Any]								=		module.bias is not None
   lowerCamelCase__	:     Union[str, Any]								=		nn.Linear(
       module.in_features     ,  module.out_features     ,  bias=_lowerCamelCase     ,  params_dtype=module.weight.dtype							)
   lowerCamelCase__	:     str								=		module.weight.data.clone()
   if has_bias:
    lowerCamelCase__	:     Optional[int]								=		module.bias.data.clone()

   setattr(_lowerCamelCase     ,  _lowerCamelCase     ,  _lowerCamelCase							)
  elif isinstance(_lowerCamelCase     ,  te.LayerNorm							) and not to_transformer_engine and _convert_ln:
   lowerCamelCase__	:     str								=		nn.LayerNorm(module.normalized_shape[0]     ,  eps=module.eps     ,  params_dtype=module.weight.dtype							)
   lowerCamelCase__	:     Dict								=		module.weight.data.clone()
   lowerCamelCase__	:     Dict								=		module.bias.data.clone()

   setattr(_lowerCamelCase     ,  _lowerCamelCase     ,  _lowerCamelCase							)
  else:
   convert_model(
       _lowerCamelCase     ,  to_transformer_engine=_lowerCamelCase     ,  _convert_linear=_convert_linear     ,  _convert_ln=_convert_ln     ,  )






def 			lowerCamelCase_    (		_lowerCamelCase							):
 if not is_fpa_available():
  raise ImportError('Using `has_transformer_engine_layers` requires transformer_engine to be installed.'							)
 for m in model.modules():
  if isinstance(_lowerCamelCase     ,  (te.LayerNorm, te.Linear)							):
   return True
 return False

