code: 
  
  
  
  
  
  
  """simple docstring"""
  
  
  
  
  
  
  import unittest
  
  from transformers import ErnieMConfig, is_torch_available
  from transformers.testing_utils import require_torch, slow, torch_device
  
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
  from ...test_pipeline_mixin import PipelineTesterMixin
  
  
  if is_torch_available():
      import torch
  
      from transformers import (
          ErnieMForInformationExtraction,
          ErnieMForMultipleChoice,
          ErnieMForQuestionAnswering,
          ErnieMForSequenceClassification,
          ErnieMForTokenClassification,
          ErnieMModel,
      )
      from transformers.models.ernie_m.modeling_ernie_m import ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST
  class 						__lowerCAmelCase   :
  
  
  
  
  
  
  
    '''simple docstring'''
  
  
    def __init__(      self:		Dict				,			UpperCamelCase_:		Optional[int]				,			UpperCamelCase_:		Optional[Any]=13				,			UpperCamelCase_:		Optional[int]=7				,			UpperCamelCase_:		Tuple=True				,			UpperCamelCase_:		List[str]=True				,			UpperCamelCase_:		int=True				,			UpperCamelCase_:		int=99				,			UpperCamelCase_:		Optional[Any]=32				,			UpperCamelCase_:		Optional[Any]=5				,			UpperCamelCase_:		Tuple=4				,			UpperCamelCase_:		Tuple=37				,			UpperCamelCase_:		Union[str, Any]="gelu"				,			UpperCamelCase_:		Tuple=0.1				,			UpperCamelCase_:		Optional[int]=0.1				,			UpperCamelCase_:		List[Any]=512				,			UpperCamelCase_:		List[Any]=16				,			UpperCamelCase_:		Dict=2				,			UpperCamelCase_:		Union[str, Any]=0.02				,			UpperCamelCase_:		Dict=3				,			UpperCamelCase_:		Any=4				,			UpperCamelCase_:		List[Any]=None				,			):
          UpperCamelCase_     =parent
          UpperCamelCase_     =batch_size
          UpperCamelCase_     =seq_length
          UpperCamelCase_     =is_training
          UpperCamelCase_     =use_input_mask
          UpperCamelCase_     =use_labels
          UpperCamelCase_     =vocab_size
          UpperCamelCase_     =hidden_size
          UpperCamelCase_     =num_hidden_layers
          UpperCamelCase_     =num_attention_heads
          UpperCamelCase_     =intermediate_size
          UpperCamelCase_     =hidden_act
          UpperCamelCase_     =hidden_dropout_prob
          UpperCamelCase_     =attention_probs_dropout_prob
          UpperCamelCase_     =max_position_embeddings
          UpperCamelCase_     =type_vocab_size
          UpperCamelCase_     =type_sequence_label_size
          UpperCamelCase_     =initializer_range
          UpperCamelCase_     =num_labels
          UpperCamelCase_     =num_choices
          UpperCamelCase_     =scope
    def 					UpperCamelCase__   (      self:		Tuple					):
          UpperCamelCase_     =ids_tensor([self.batch_size, self.seq_length]				,			self.vocab_size					)
  
          UpperCamelCase_     =None
          if self.use_input_mask:
                UpperCamelCase_     =random_attention_mask([self.batch_size, self.seq_length]					)
  
          UpperCamelCase_     =None
          UpperCamelCase_     =None
          UpperCamelCase_     =None
          if self.use_labels:
                UpperCamelCase_     =ids_tensor([self.batch_size]				,			self.type_sequence_label_size					)
                UpperCamelCase_     =ids_tensor([self.batch_size, self.seq_length]				,			self.num_labels					)
                UpperCamelCase_     =ids_tensor([self.batch_size]				,			self.num_choices					)
  
          UpperCamelCase_     =self.get_config()
  
          return config, input_ids, input_mask, sequence_labels, token_labels, choice_labels
    def 					UpperCamelCase__   (      self:		List[Any]					):
          UpperCamelCase_     =ids_tensor([self.batch_size, self.seq_length]				,			self.vocab_size					)
  
          UpperCamelCase_     =None
          if self.use_input_mask:
                UpperCamelCase_     =random_attention_mask([self.batch_size, self.seq_length]					)
          UpperCamelCase_     =self.get_config()
  
          return config, input_ids, input_mask
    def 					UpperCamelCase__   (      self:		Dict					):
          return ErnieMConfig(
              vocab_size=self.vocab_size				,			hidden_size=self.hidden_size				,			num_hidden_layers=self.num_hidden_layers				,			num_attention_heads=self.num_attention_heads				,			intermediate_size=self.intermediate_size				,			hidden_act=self.hidden_act				,			hidden_dropout_prob=self.hidden_dropout_prob				,			attention_probs_dropout_prob=self.attention_probs_dropout_prob				,			max_position_embeddings=self.max_position_embeddings				,			type_vocab_size=self.type_vocab_size				,			initializer_range=self.initializer_range				,			)
    def 					UpperCamelCase__   (      self:		Optional[int]				,			UpperCamelCase_:		Optional[Any]				,			UpperCamelCase_:		Union[str, Any]				,			UpperCamelCase_:		List[str]				,			UpperCamelCase_:		Union[str, Any]				,			UpperCamelCase_:		Union[str, Any]				,			UpperCamelCase_:		Dict					):
          UpperCamelCase_     =ErnieMModel(config=SCREAMING_SNAKE_CASE_					)
          model.to(SCREAMING_SNAKE_CASE_					)
          model.eval()
          UpperCamelCase_     =model(SCREAMING_SNAKE_CASE_				,			return_dict=SCREAMING_SNAKE_CASE_					)
          self.parent.assertEqual(result.last_hidden_state.shape				,			(self.batch_size, self.seq_length, self.hidden_size)					)
    def 					UpperCamelCase__   (      self:		List[str]				,			UpperCamelCase_:		List[Any]				,			UpperCamelCase_:		List[str]				,			UpperCamelCase_:		Optional[Any]				,			UpperCamelCase_:		Tuple				,			UpperCamelCase_:		Optional[Any]				,			UpperCamelCase_:		Union[str, Any]					):
          UpperCamelCase_     =ErnieMForQuestionAnswering(config=SCREAMING_SNAKE_CASE_					)
          model.to(SCREAMING_SNAKE_CASE_					)
          model.eval()
          UpperCamelCase_     =model(
              SCREAMING_SNAKE_CASE_				,			attention_mask=SCREAMING_SNAKE_CASE_				,			start_positions=SCREAMING_SNAKE_CASE_				,			end_positions=SCREAMING_SNAKE_CASE_				,			)
          self.parent.assertEqual(result.start_logits.shape				,			(self.batch_size, self.seq_length)					)
          self.parent.assertEqual(result.end_logits.shape				,			(self.batch_size, self.seq_length)					)
    def 					UpperCamelCase__   (      self:		Dict				,			UpperCamelCase_:		Any				,			UpperCamelCase_:		Dict				,			UpperCamelCase_:		Optional[int]				,			UpperCamelCase_:		Optional[int]				,			UpperCamelCase_:		Optional[Any]				,			UpperCamelCase_:		Union[str, Any]					):
          UpperCamelCase_     =ErnieMForInformationExtraction(config=SCREAMING_SNAKE_CASE_					)
          model.to(SCREAMING_SNAKE_CASE_					)
          model.eval()
          UpperCamelCase_     =torch.ones_like(SCREAMING_SNAKE_CASE_				,			dtype=torch.floataa					)
          UpperCamelCase_     =model(
              SCREAMING_SNAKE_CASE_				,			attention_mask=SCREAMING_SNAKE_CASE_				,			start_positions=SCREAMING_SNAKE_CASE_				,			end_positions=SCREAMING_SNAKE_CASE_				,			)
          self.parent.assertEqual(result.start_logits.shape				,			(self.batch_size, self.seq_length)					)
          self.parent.assertEqual(result.end_logits.shape				,			(self.batch_size, self.seq_length)					)
    def 					UpperCamelCase__   (      self:		Union[str, Any]				,			UpperCamelCase_:		Tuple				,			UpperCamelCase_:		str				,			UpperCamelCase_:		Optional[int]				,			UpperCamelCase_:		List[Any]				,			UpperCamelCase_:		Any				,			UpperCamelCase_:		Optional[Any]					):
          UpperCamelCase_     =self.num_labels
          UpperCamelCase_     =ErnieMForSequenceClassification(SCREAMING_SNAKE_CASE_					)
          model.to(SCREAMING_SNAKE_CASE_					)
          model.eval()
          UpperCamelCase_     =model(SCREAMING_SNAKE_CASE_				,			attention_mask=SCREAMING_SNAKE_CASE_				,			labels=SCREAMING_SNAKE_CASE_					)
          self.parent.assertEqual(result.logits.shape				,			(self.batch_size, self.num_labels)					)
    def 					UpperCamelCase__   (      self:		str				,			UpperCamelCase_:		str				,			UpperCamelCase_:		Tuple				,			UpperCamelCase_:		Any				,			UpperCamelCase_:		List[str]				,			UpperCamelCase_:		Tuple				,			UpperCamelCase_:		List[str]					):
          UpperCamelCase_     =self.num_labels
          UpperCamelCase_     =ErnieMForTokenClassification(config=SCREAMING_SNAKE_CASE_					)
          model.to(SCREAMING_SNAKE_CASE_					)
          model.eval()
          input_ids.to(SCREAMING_SNAKE_CASE_					)
          input_mask.to(SCREAMING_SNAKE_CASE_					)
          token_labels.to(SCREAMING_SNAKE_CASE_					)
  
          UpperCamelCase_     =model(SCREAMING_SNAKE_CASE_				,			attention_mask=SCREAMING_SNAKE_CASE_				,			labels=SCREAMING_SNAKE_CASE_					)
  
          self.parent.assertEqual(result.logits.shape				,			(self.batch_size, self.seq_length, self.num_labels)					)
    def 					UpperCamelCase__   (      self:		Dict				,			UpperCamelCase_:		Union[str, Any]				,			UpperCamelCase_:		Union[str, Any]				,			UpperCamelCase_:		Optional[Any]				,			UpperCamelCase_:		Union[str, Any]				,			UpperCamelCase_:		Optional[int]				,			UpperCamelCase_:		Union[str, Any]					):
          UpperCamelCase_     =self.num_choices
          UpperCamelCase_     =ErnieMForMultipleChoice(config=SCREAMING_SNAKE_CASE_					)
          model.to(SCREAMING_SNAKE_CASE_					)
          model.eval()
          UpperCamelCase_     =input_ids.unsqueeze(1					).expand(-1				,			self.num_choices				,			-1					).contiguous()
          UpperCamelCase_     =input_mask.unsqueeze(1					).expand(-1				,			self.num_choices				,			-1					).contiguous()
          UpperCamelCase_     =model(
              SCREAMING_SNAKE_CASE_				,			attention_mask=SCREAMING_SNAKE_CASE_				,			labels=SCREAMING_SNAKE_CASE_				,			)
          self.parent.assertEqual(result.logits.shape				,			(self.batch_size, self.num_choices)					)
  
  
  
  
  
    def 					UpperCamelCase__   (      self:		Dict					):
          UpperCamelCase_     =self.prepare_config_and_inputs()
          (
              UpperCamelCase_  
          )     =config_and_inputs
          UpperCamelCase_     ={'input_ids': input_ids, 'attention_mask': input_mask}
          return config, inputs_dict
  
  
  
  
  @require_torch
  class 						__lowerCAmelCase   (			a__       ,   a__       ,   unittest.TestCase       ):
  
  
  
  
  
  
  
    '''simple docstring'''
  
  
    __lowerCamelCase       :    Tuple     	=			(
        (
            ErnieMModel,
            ErnieMForMultipleChoice,
            ErnieMForQuestionAnswering,
            ErnieMForSequenceClassification,
            ErnieMForTokenClassification,
        )
        if is_torch_available()
        else ()
    )
    __lowerCamelCase       :    List[str]     	=			()
    __lowerCamelCase       :    int     	=			(
        {
            "feature-extraction": ErnieMModel,
            "question-answering": ErnieMForQuestionAnswering,
            "text-classification": ErnieMForSequenceClassification,
            "token-classification": ErnieMForTokenClassification,
            "zero-shot": ErnieMForSequenceClassification,
        }
        if is_torch_available()
        else {}
    )
    __lowerCamelCase       :    Tuple     	=			False
    def 					UpperCamelCase__   (      self:		Any				,			UpperCamelCase_:		List[str]				,			UpperCamelCase_:		List[str]				,			UpperCamelCase_:		int				,			UpperCamelCase_:		Any				,			UpperCamelCase_:		Optional[int]					):
          if pipeline_test_casse_name == "QAPipelineTests":
                return True
  
          return False
    def 					UpperCamelCase__   (      self:		str					):
          UpperCamelCase_     =ErnieMModelTester(self					)
          UpperCamelCase_     =ConfigTester(self				,			config_class=SCREAMING_SNAKE_CASE_				,			hidden_size=37					)
    def 					UpperCamelCase__   (      self:		List[Any]					):
          self.config_tester.run_common_tests()
    def 					UpperCamelCase__   (      self:		Union[str, Any]					):
          UpperCamelCase_     =self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_model(*SCREAMING_SNAKE_CASE_					)
    def 					UpperCamelCase__   (      self:		List[Any]					):
          UpperCamelCase_     =self.model_tester.prepare_config_and_inputs()
          for type in ["absolute", "relative_key", "relative_key_query"]:
                UpperCamelCase_     =type
                self.model_tester.create_and_check_model(*SCREAMING_SNAKE_CASE_					)
    def 					UpperCamelCase__   (      self:		List[str]					):
          UpperCamelCase_     =self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_for_multiple_choice(*SCREAMING_SNAKE_CASE_					)
    def 					UpperCamelCase__   (      self:		Optional[Any]					):
          UpperCamelCase_     =self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_for_question_answering(*SCREAMING_SNAKE_CASE_					)
    def 					UpperCamelCase__   (      self:		Optional[int]					):
          UpperCamelCase_     =self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_for_sequence_classification(*SCREAMING_SNAKE_CASE_					)
    def 					UpperCamelCase__   (      self:		List[str]					):
          UpperCamelCase_     =self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_for_information_extraction(*SCREAMING_SNAKE_CASE_					)
    def 					UpperCamelCase__   (      self:		Dict					):
          UpperCamelCase_     =self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_for_token_classification(*SCREAMING_SNAKE_CASE_					)
  
  
  
  
  
    @slow
    def 					UpperCamelCase__   (      self:		Optional[int]					):
          for model_name in ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                UpperCamelCase_     =ErnieMModel.from_pretrained(SCREAMING_SNAKE_CASE_					)
                self.assertIsNotNone(SCREAMING_SNAKE_CASE_					)
  
  
  
  
  @require_torch
  class 						__lowerCAmelCase   (			unittest.TestCase       ):
  
  
  
  
  
  
  
    '''simple docstring'''
  
  
    @slow
    def 					UpperCamelCase__   (      self:		Optional[Any]					):
          UpperCamelCase_     =ErnieMModel.from_pretrained("susnato/ernie-m-base_pytorch"					)
          model.eval()
          UpperCamelCase_     =torch.tensor([[0, 1, 2, 3, 4, 5]]					)
          UpperCamelCase_     =model(SCREAMING_SNAKE_CASE_					)[0]
  
          # TODO Replace vocab size
          UpperCamelCase_     =768
  
          UpperCamelCase_     =torch.Size((1, 6, hidden_size)					)
          self.assertEqual(output.shape				,			SCREAMING_SNAKE_CASE_					)
  
          UpperCamelCase_     =torch.tensor(
              [[[-0.0012, 0.1245, -0.0214], [-0.0742, 0.0244, -0.0771], [-0.0333, 0.1164, -0.1554]]]					)
  
          self.assertTrue(torch.allclose(output[:, :3, :3]				,			SCREAMING_SNAKE_CASE_				,			atol=1e-3					)					)
  
style_context: 
  
  
  
  
  
  
  """simple docstring"""
  
  
  
  
  
  
  from math import radians as angle_to_radians
  from math import sin
  
  # Acceleration Constant on Earth (unit m/s^2)
  A_			  =    9.80665
  
  
  
  
  def 						_UpperCamelCase			(  A    ,       A			):
  
     # Ensure valid instance
     if not isinstance(A    ,       (int, float)			):
        raise TypeError("Invalid velocity. Should be a positive number."			)
  
     if not isinstance(A    ,       (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 						_UpperCamelCase			(  A    ,       A			):
     check_args(A    ,       A			)
     UpperCamelCase_     =angle_to_radians(2 * angle			)
     return round(init_velocity**2 * sin(A			) / g    ,       2			)
  
  
  
  
  def 						_UpperCamelCase			(  A    ,       A			):
     check_args(A    ,       A			)
     UpperCamelCase_     =angle_to_radians(A			)
     return round(init_velocity**2 * sin(A			) ** 2 / (2 * g)    ,       2			)
  
  
  
  
  def 						_UpperCamelCase			(  A    ,       A			):
     check_args(A    ,       A			)
     UpperCamelCase_     =angle_to_radians(A			)
     return round(2 * init_velocity * sin(A			) / g    ,       2			)
  
  
  
  
  def 						_UpperCamelCase			(  ):
     UpperCamelCase_    ,							UpperCamelCase_     =25, 20
     assert horizontal_distance(A    ,       A			) == 40.97
     assert max_height(A    ,       A			) == 3.73
     assert total_time(A    ,       A			) == 1.74
  
  
  if __name__ == "__main__":
      from doctest import testmod
  
      testmod()
  
      # Get input from user
      A_			  =    float(input("Initial Velocity: ").strip())
  
      # Get input from user
      A_			  =    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]''')
  