code: 
  
  
  """simple docstring"""
  
  
  
  
  import tempfile
  
  import torch
  
  from diffusers import (
      DEISMultistepScheduler,
      DPMSolverMultistepScheduler,
      DPMSolverSinglestepScheduler,
      UniPCMultistepScheduler,
  )
  
  from .test_schedulers import SchedulerCommonTest
  
  
  
  
  class  __snake_case      (lowerCamelCase     ):
  							__a				   =					(DPMSolverMultistepScheduler,)
  							__a				   =					(('''num_inference_steps''', 25),)
  
  
  
  
  							def      __a      (    self:						Dict    ,       **A_:						Optional[int]      ):
  														__lowerCamelCase        =			{
  														    """num_train_timesteps""": 10_00,
  														    """beta_start""": 0.0_001,
  														    """beta_end""": 0.02,
  														    """beta_schedule""": """linear""",
  														    """solver_order""": 2,
  														    """prediction_type""": """epsilon""",
  														    """thresholding""": False,
  														    """sample_max_value""": 1.0,
  														    """algorithm_type""": """dpmsolver++""",
  														    """solver_type""": """midpoint""",
  														    """lower_order_final""": False,
  														    """lambda_min_clipped""": -float("""inf"""      ),
  														    """variance_type""": None,
  														}
  
  														config.update(**A_      )
  														return config
  
  
  
  
  							def      __a      (    self:						int    ,       A_:						Dict=0    ,       **A_:						Optional[int]      ):
  														__lowerCamelCase        =			dict(self.forward_default_kwargs      )
  														__lowerCamelCase        =			kwargs.pop("""num_inference_steps"""    ,       A_      )
  														__lowerCamelCase        =			self.dummy_sample
  														__lowerCamelCase        =			0.1 * sample
  														__lowerCamelCase        =			[residual + 0.2, residual + 0.15, residual + 0.10]
  
  														for scheduler_class in self.scheduler_classes:
  																					__lowerCamelCase        =			self.get_scheduler_config(**A_      )
  																					__lowerCamelCase        =			scheduler_class(**A_      )
  																					scheduler.set_timesteps(A_      )
  																					# copy over dummy past residuals
  																					__lowerCamelCase        =			dummy_past_residuals[: scheduler.config.solver_order]
  
  																					with tempfile.TemporaryDirectory() as tmpdirname:
  																												scheduler.save_config(A_      )
  																												__lowerCamelCase        =			scheduler_class.from_pretrained(A_      )
  																												new_scheduler.set_timesteps(A_      )
  																												# copy over dummy past residuals
  																												__lowerCamelCase        =			dummy_past_residuals[: new_scheduler.config.solver_order]
  
  																					__lowerCamelCase    ,__lowerCamelCase        =			sample, sample
  																					for t in range(A_    ,       time_step + scheduler.config.solver_order + 1      ):
  																												__lowerCamelCase        =			scheduler.step(A_    ,       A_    ,       A_    ,       **A_      ).prev_sample
  																												__lowerCamelCase        =			new_scheduler.step(A_    ,       A_    ,       A_    ,       **A_      ).prev_sample
  
  																												assert torch.sum(torch.abs(output - new_output      )      ) < 1E-5, "Scheduler outputs are not identical"
  
  
  
  
  							def      __a      (    self:						Union[str, Any]      ):
  														pass
  
  
  
  
  							def      __a      (    self:						Union[str, Any]    ,       A_:						int=0    ,       **A_:						Any      ):
  														__lowerCamelCase        =			dict(self.forward_default_kwargs      )
  														__lowerCamelCase        =			kwargs.pop("""num_inference_steps"""    ,       A_      )
  														__lowerCamelCase        =			self.dummy_sample
  														__lowerCamelCase        =			0.1 * sample
  														__lowerCamelCase        =			[residual + 0.2, residual + 0.15, residual + 0.10]
  
  														for scheduler_class in self.scheduler_classes:
  																					__lowerCamelCase        =			self.get_scheduler_config()
  																					__lowerCamelCase        =			scheduler_class(**A_      )
  																					scheduler.set_timesteps(A_      )
  
  																					# copy over dummy past residuals (must be after setting timesteps)
  																					__lowerCamelCase        =			dummy_past_residuals[: scheduler.config.solver_order]
  
  																					with tempfile.TemporaryDirectory() as tmpdirname:
  																												scheduler.save_config(A_      )
  																												__lowerCamelCase        =			scheduler_class.from_pretrained(A_      )
  																												# copy over dummy past residuals
  																												new_scheduler.set_timesteps(A_      )
  
  																												# copy over dummy past residual (must be after setting timesteps)
  																												__lowerCamelCase        =			dummy_past_residuals[: new_scheduler.config.solver_order]
  
  																					__lowerCamelCase        =			scheduler.step(A_    ,       A_    ,       A_    ,       **A_      ).prev_sample
  																					__lowerCamelCase        =			new_scheduler.step(A_    ,       A_    ,       A_    ,       **A_      ).prev_sample
  
  																					assert torch.sum(torch.abs(output - new_output      )      ) < 1E-5, "Scheduler outputs are not identical"
  
  
  
  
  							def      __a      (    self:						int    ,       A_:						str=None    ,       **A_:						int      ):
  														if scheduler is None:
  																					__lowerCamelCase        =			self.scheduler_classes[0]
  																					__lowerCamelCase        =			self.get_scheduler_config(**A_      )
  																					__lowerCamelCase        =			scheduler_class(**A_      )
  
  														__lowerCamelCase        =			10
  														__lowerCamelCase        =			self.dummy_model()
  														__lowerCamelCase        =			self.dummy_sample_deter
  														scheduler.set_timesteps(A_      )
  
  														for i, t in enumerate(scheduler.timesteps      ):
  																					__lowerCamelCase        =			model(A_    ,       A_      )
  																					__lowerCamelCase        =			scheduler.step(A_    ,       A_    ,       A_      ).prev_sample
  
  														return sample
  
  
  
  
  							def      __a      (    self:						Union[str, Any]      ):
  														__lowerCamelCase        =			dict(self.forward_default_kwargs      )
  
  														__lowerCamelCase        =			kwargs.pop("""num_inference_steps"""    ,       A_      )
  
  														for scheduler_class in self.scheduler_classes:
  																					__lowerCamelCase        =			self.get_scheduler_config()
  																					__lowerCamelCase        =			scheduler_class(**A_      )
  
  																					__lowerCamelCase        =			self.dummy_sample
  																					__lowerCamelCase        =			0.1 * sample
  
  																					if num_inference_steps is not None and hasattr(A_    ,       """set_timesteps"""      ):
  																												scheduler.set_timesteps(A_      )
  																					elif num_inference_steps is not None and not hasattr(A_    ,       """set_timesteps"""      ):
  																												__lowerCamelCase        =			num_inference_steps
  
  																					# copy over dummy past residuals (must be done after set_timesteps)
  																					__lowerCamelCase        =			[residual + 0.2, residual + 0.15, residual + 0.10]
  																					__lowerCamelCase        =			dummy_past_residuals[: scheduler.config.solver_order]
  
  																					__lowerCamelCase        =			scheduler.timesteps[5]
  																					__lowerCamelCase        =			scheduler.timesteps[6]
  
  																					__lowerCamelCase        =			scheduler.step(A_    ,       A_    ,       A_    ,       **A_      ).prev_sample
  																					__lowerCamelCase        =			scheduler.step(A_    ,       A_    ,       A_    ,       **A_      ).prev_sample
  
  																					self.assertEqual(output_a.shape    ,       sample.shape      )
  																					self.assertEqual(output_a.shape    ,       output_a.shape      )
  
  
  
  
  							def      __a      (    self:						Dict      ):
  														for timesteps in [25, 50, 1_00, 9_99, 10_00]:
  																					self.check_over_configs(num_train_timesteps=A_      )
  
  
  
  
  							def      __a      (    self:						Tuple      ):
  														self.check_over_configs(thresholding=A_      )
  														for order in [1, 2, 3]:
  																					for solver_type in ["midpoint", "heun"]:
  																												for threshold in [0.5, 1.0, 2.0]:
  																																			for prediction_type in ["epsilon", "sample"]:
  																																										self.check_over_configs(
  																																										    thresholding=A_    ,       prediction_type=A_    ,       sample_max_value=A_    ,       algorithm_type="""dpmsolver++"""    ,       solver_order=A_    ,       solver_type=A_    ,       )
  
  
  
  
  							def      __a      (    self:						Optional[int]      ):
  														for prediction_type in ["epsilon", "v_prediction"]:
  																					self.check_over_configs(prediction_type=A_      )
  
  
  
  
  							def      __a      (    self:						Union[str, Any]      ):
  														for algorithm_type in ["dpmsolver", "dpmsolver++", "sde-dpmsolver", "sde-dpmsolver++"]:
  																					for solver_type in ["midpoint", "heun"]:
  																												for order in [1, 2, 3]:
  																																			for prediction_type in ["epsilon", "sample"]:
  																																										if algorithm_type in ["sde-dpmsolver", "sde-dpmsolver++"]:
  																																																	if order == 3:
  																																																								continue
  																																										else:
  																																																	self.check_over_configs(
  																																																	    solver_order=A_    ,       solver_type=A_    ,       prediction_type=A_    ,       algorithm_type=A_    ,       )
  																																										__lowerCamelCase        =			self.full_loop(
  																																										    solver_order=A_    ,       solver_type=A_    ,       prediction_type=A_    ,       algorithm_type=A_    ,       )
  																																										assert not torch.isnan(A_      ).any(), "Samples have nan numbers"
  
  
  
  
  							def      __a      (    self:						List[str]      ):
  														self.check_over_configs(lower_order_final=A_      )
  														self.check_over_configs(lower_order_final=A_      )
  
  
  
  
  							def      __a      (    self:						Dict      ):
  														self.check_over_configs(lambda_min_clipped=-float("""inf"""      )      )
  														self.check_over_configs(lambda_min_clipped=-5.1      )
  
  
  
  
  							def      __a      (    self:						List[str]      ):
  														self.check_over_configs(variance_type=A_      )
  														self.check_over_configs(variance_type="""learned_range"""      )
  
  
  
  
  							def      __a      (    self:						Dict      ):
  														for num_inference_steps in [1, 2, 3, 5, 10, 50, 1_00, 9_99, 10_00]:
  																					self.check_over_forward(num_inference_steps=A_    ,       time_step=0      )
  
  
  
  
  							def      __a      (    self:						Dict      ):
  														__lowerCamelCase        =			self.full_loop()
  														__lowerCamelCase        =			torch.mean(torch.abs(A_      )      )
  
  														assert abs(result_mean.item() - 0.3_301      ) < 1E-3
  
  
  
  
  							def      __a      (    self:						int      ):
  														__lowerCamelCase        =			self.full_loop(thresholding=A_    ,       dynamic_thresholding_ratio=0.87    ,       sample_max_value=0.5      )
  														__lowerCamelCase        =			torch.mean(torch.abs(A_      )      )
  
  														assert abs(result_mean.item() - 1.1_364      ) < 1E-3
  
  
  
  
  							def      __a      (    self:						List[str]      ):
  														__lowerCamelCase        =			self.full_loop(prediction_type="""v_prediction"""      )
  														__lowerCamelCase        =			torch.mean(torch.abs(A_      )      )
  
  														assert abs(result_mean.item() - 0.2_251      ) < 1E-3
  
  
  
  
  							def      __a      (    self:						Optional[Any]      ):
  														__lowerCamelCase        =			self.full_loop(prediction_type="""v_prediction"""    ,       use_karras_sigmas=A_      )
  														__lowerCamelCase        =			torch.mean(torch.abs(A_      )      )
  
  														assert abs(result_mean.item() - 0.2_096      ) < 1E-3
  
  
  
  
  							def      __a      (    self:						List[str]      ):
  														# make sure that iterating over schedulers with same config names gives same results
  														# for defaults
  														__lowerCamelCase        =			DPMSolverMultistepScheduler(**self.get_scheduler_config()      )
  														__lowerCamelCase        =			self.full_loop(scheduler=A_      )
  														__lowerCamelCase        =			torch.mean(torch.abs(A_      )      )
  
  														assert abs(result_mean.item() - 0.3_301      ) < 1E-3
  
  														__lowerCamelCase        =			DPMSolverSinglestepScheduler.from_config(scheduler.config      )
  														__lowerCamelCase        =			UniPCMultistepScheduler.from_config(scheduler.config      )
  														__lowerCamelCase        =			DEISMultistepScheduler.from_config(scheduler.config      )
  														__lowerCamelCase        =			DPMSolverMultistepScheduler.from_config(scheduler.config      )
  
  														__lowerCamelCase        =			self.full_loop(scheduler=A_      )
  														__lowerCamelCase        =			torch.mean(torch.abs(A_      )      )
  
  														assert abs(result_mean.item() - 0.3_301      ) < 1E-3
  
  
  
  
  							def      __a      (    self:						List[str]      ):
  														__lowerCamelCase        =			self.scheduler_classes[0]
  														__lowerCamelCase        =			self.get_scheduler_config(thresholding=A_    ,       dynamic_thresholding_ratio=0      )
  														__lowerCamelCase        =			scheduler_class(**A_      )
  
  														__lowerCamelCase        =			10
  														__lowerCamelCase        =			self.dummy_model()
  														__lowerCamelCase        =			self.dummy_sample_deter.half()
  														scheduler.set_timesteps(A_      )
  
  														for i, t in enumerate(scheduler.timesteps      ):
  																					__lowerCamelCase        =			model(A_    ,       A_      )
  																					__lowerCamelCase        =			scheduler.step(A_    ,       A_    ,       A_      ).prev_sample
  
  														assert sample.dtype == torch.floataa
  
  
  
  
  							def      __a      (    self:						Any    ,       **A_:						int      ):
  														for scheduler_class in self.scheduler_classes:
  																					__lowerCamelCase        =			self.get_scheduler_config(**A_      )
  																					__lowerCamelCase        =			scheduler_class(**A_      )
  
  																					scheduler.set_timesteps(scheduler.config.num_train_timesteps      )
  																					assert len(scheduler.timesteps.unique()      ) == scheduler.num_inference_steps
  
  
  
  
  
style_context: 
  
  
  """simple docstring"""
  
  
  
  
  import numpy as np
  
  
  
  
  
  def 			a_   (  lowercase__   :List[str]    ):
  			__lowerCamelCase        =			np.exp(lowercase__    )
  
  			# Add up the all the exponentials
  			__lowerCamelCase        =			np.sum(lowercase__    )
  
  			# Divide every exponent by the sum of all exponents
  			__lowerCamelCase        =			exponent_vector / sum_of_exponents
  
  			return softmax_vector
  
  
  if __name__ == "__main__":
  					print(softmax((0,)))
  
  
  
  
  