code: 
  
  
  
  
  
  
  """simple docstring"""
  
  
  
  
  
  
  import unittest
  
  import numpy as np
  import torch
  
  from diffusers import DDPMPipeline, DDPMScheduler, UNetaDModel
  from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device
  
  
  enable_full_determinism()
  class 						__lowerCAmelCase   (			unittest.TestCase       ):
  
  
  
  
  
  
  
    '''simple docstring'''
  
  
    @property
    def 					UpperCamelCase__   (      self:		Dict					):
       torch.manual_seed(0					)
       UpperCamelCase_     =UNetaDModel(
           block_out_channels=(32, 64)				,			layers_per_block=2				,			sample_size=32				,			in_channels=3				,			out_channels=3				,			down_block_types=("DownBlock2D", "AttnDownBlock2D")				,			up_block_types=("AttnUpBlock2D", "UpBlock2D")				,			)
       return model
    def 					UpperCamelCase__   (      self:		int					):
       UpperCamelCase_     ="cpu"
       UpperCamelCase_     =self.dummy_uncond_unet
       UpperCamelCase_     =DDPMScheduler()
  
       UpperCamelCase_     =DDPMPipeline(unet=UpperCamelCase_				,			scheduler=UpperCamelCase_					)
       ddpm.to(UpperCamelCase_					)
       ddpm.set_progress_bar_config(disable=UpperCamelCase_					)
  
       UpperCamelCase_     =torch.Generator(device=UpperCamelCase_					).manual_seed(0					)
       UpperCamelCase_     =ddpm(generator=UpperCamelCase_				,			num_inference_steps=2				,			output_type="numpy"					).images
  
       UpperCamelCase_     =torch.Generator(device=UpperCamelCase_					).manual_seed(0					)
       UpperCamelCase_     =ddpm(generator=UpperCamelCase_				,			num_inference_steps=2				,			output_type="numpy"				,			return_dict=UpperCamelCase_					)[0]
  
       UpperCamelCase_     =image[0, -3:, -3:, -1]
       UpperCamelCase_     =image_from_tuple[0, -3:, -3:, -1]
  
       assert image.shape == (1, 32, 32, 3)
       UpperCamelCase_     =np.array(
           [9.9_5_6e-0_1, 5.7_8_5e-0_1, 4.6_7_5e-0_1, 9.9_3_0e-0_1, 0.0, 1.000, 1.1_9_9e-0_3, 2.6_4_8e-0_4, 5.1_0_1e-0_4]					)
  
       assert np.abs(image_slice.flatten() - expected_slice					).max() < 1e-2
       assert np.abs(image_from_tuple_slice.flatten() - expected_slice					).max() < 1e-2
  
  
  
  
  
    def 					UpperCamelCase__   (      self:		str					):
       UpperCamelCase_     =self.dummy_uncond_unet
       UpperCamelCase_     =DDPMScheduler(prediction_type="sample"					)
  
       UpperCamelCase_     =DDPMPipeline(unet=UpperCamelCase_				,			scheduler=UpperCamelCase_					)
       ddpm.to(UpperCamelCase_					)
       ddpm.set_progress_bar_config(disable=UpperCamelCase_					)
  
       UpperCamelCase_     =torch.manual_seed(0					)
       UpperCamelCase_     =ddpm(generator=UpperCamelCase_				,			num_inference_steps=2				,			output_type="numpy"					).images
  
       UpperCamelCase_     =torch.manual_seed(0					)
       UpperCamelCase_     =ddpm(generator=UpperCamelCase_				,			num_inference_steps=2				,			output_type="numpy"					)[0]
  
       UpperCamelCase_     =image[0, -3:, -3:, -1]
       UpperCamelCase_     =image_eps[0, -3:, -3:, -1]
  
       assert image.shape == (1, 32, 32, 3)
       UpperCamelCase_     =1e-2 if torch_device != "mps" else 3e-2
       assert np.abs(image_slice.flatten() - image_eps_slice.flatten()					).max() < tolerance
  
  
  
  
  @slow
  @require_torch_gpu
  class 						__lowerCAmelCase   (			unittest.TestCase       ):
  
  
  
  
  
  
  
    '''simple docstring'''
  
  
    def 					UpperCamelCase__   (      self:		Optional[Any]					):
       UpperCamelCase_     ="google/ddpm-cifar10-32"
  
       UpperCamelCase_     =UNetaDModel.from_pretrained(UpperCamelCase_					)
       UpperCamelCase_     =DDPMScheduler.from_pretrained(UpperCamelCase_					)
  
       UpperCamelCase_     =DDPMPipeline(unet=UpperCamelCase_				,			scheduler=UpperCamelCase_					)
       ddpm.to(UpperCamelCase_					)
       ddpm.set_progress_bar_config(disable=UpperCamelCase_					)
  
       UpperCamelCase_     =torch.manual_seed(0					)
       UpperCamelCase_     =ddpm(generator=UpperCamelCase_				,			output_type="numpy"					).images
  
       UpperCamelCase_     =image[0, -3:, -3:, -1]
  
       assert image.shape == (1, 32, 32, 3)
       UpperCamelCase_     =np.array([0.4200, 0.3588, 0.1939, 0.3847, 0.3382, 0.2647, 0.4155, 0.3582, 0.3385]					)
       assert np.abs(image_slice.flatten() - expected_slice					).max() < 1e-2
  
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]''')
  