





'''simple docstring'''







import torch

from diffusers import KDPMaDiscreteScheduler
from diffusers.utils import torch_device

from .test_schedulers import SchedulerCommonTest
class 				__SCREAMING_SNAKE_CASE  (lowerCamelCase_      ):






				"""simple docstring"""







				__a            =(KDPMaDiscreteScheduler,)
				__a            =10




				def   UpperCamelCase__   (  self     :					Any					,				**__a     :					Optional[int]					):
								_a								= {
								    "num_train_timesteps": 11_00,
								    "beta_start": 0.0001,
								    "beta_end": 0.02,
								    "beta_schedule": "linear",
								}

								config.update(**__a					)
								return config




				def   UpperCamelCase__   (  self     :					Any					):
								for timesteps in [10, 50, 1_00, 10_00]:
												self.check_over_configs(num_train_timesteps=__a					)




				def   UpperCamelCase__   (  self     :					int					):
								for beta_start, beta_end in zip([0.00001, 0.0001, 0.001]					,				[0.0002, 0.002, 0.02]					):
												self.check_over_configs(beta_start=__a					,				beta_end=__a					)




				def   UpperCamelCase__   (  self     :					List[str]					):
								for schedule in ["linear", "scaled_linear"]:
												self.check_over_configs(beta_schedule=__a					)




				def   UpperCamelCase__   (  self     :					Any					):
								for prediction_type in ["epsilon", "v_prediction"]:
												self.check_over_configs(prediction_type=__a					)




				def   UpperCamelCase__   (  self     :					Tuple					):
								_a								= self.scheduler_classes[0]
								_a								= self.get_scheduler_config(prediction_type="v_prediction"					)
								_a								= scheduler_class(**__a					)

								scheduler.set_timesteps(self.num_inference_steps					)

								_a								= self.dummy_model()
								_a								= self.dummy_sample_deter * scheduler.init_noise_sigma
								_a								= sample.to(__a					)

								for i, t in enumerate(scheduler.timesteps					):
												_a								= scheduler.scale_model_input(__a					,				__a					)

												_a								= model(__a					,				__a					)

												_a								= scheduler.step(__a					,				__a					,				__a					)
												_a								= output.prev_sample

								_a								= torch.sum(torch.abs(__a					)					)
								_a								= torch.mean(torch.abs(__a					)					)

								if torch_device in ["cpu", "mps"]:
												assert abs(result_sum.item() - 4.6_9_3_4e-0_7					) < 1e-2
												assert abs(result_mean.item() - 6.1_1_1_2e-1_0					) < 1e-3
								else:
												# CUDA
												assert abs(result_sum.item() - 4.6_9_3_4_2_8_6_5_0_1_7_0_9_7_2e-0_7					) < 1e-2
												assert abs(result_mean.item() - 0.0002					) < 1e-3




				def   UpperCamelCase__   (  self     :					Union[str, Any]					):
								if torch_device == "mps":
												return
								_a								= self.scheduler_classes[0]
								_a								= self.get_scheduler_config()
								_a								= scheduler_class(**__a					)

								scheduler.set_timesteps(self.num_inference_steps					)

								_a								= self.dummy_model()
								_a								= self.dummy_sample_deter * scheduler.init_noise_sigma
								_a								= sample.to(__a					)

								for i, t in enumerate(scheduler.timesteps					):
												_a								= scheduler.scale_model_input(__a					,				__a					)

												_a								= model(__a					,				__a					)

												_a								= scheduler.step(__a					,				__a					,				__a					)
												_a								= output.prev_sample

								_a								= torch.sum(torch.abs(__a					)					)
								_a								= torch.mean(torch.abs(__a					)					)

								if torch_device in ["cpu", "mps"]:
												assert abs(result_sum.item() - 20.4125					) < 1e-2
												assert abs(result_mean.item() - 0.0266					) < 1e-3
								else:
												# CUDA
												assert abs(result_sum.item() - 20.4125					) < 1e-2
												assert abs(result_mean.item() - 0.0266					) < 1e-3




				def   UpperCamelCase__   (  self     :					str					):
								if torch_device == "mps":
												return
								_a								= self.scheduler_classes[0]
								_a								= self.get_scheduler_config()
								_a								= scheduler_class(**__a					)

								scheduler.set_timesteps(self.num_inference_steps					,				device=__a					)

								_a								= self.dummy_model()
								_a								= self.dummy_sample_deter.to(__a					) * scheduler.init_noise_sigma

								for t in scheduler.timesteps:
												_a								= scheduler.scale_model_input(__a					,				__a					)

												_a								= model(__a					,				__a					)

												_a								= scheduler.step(__a					,				__a					,				__a					)
												_a								= output.prev_sample

								_a								= torch.sum(torch.abs(__a					)					)
								_a								= torch.mean(torch.abs(__a					)					)

								if str(__a					).startswith("cpu"					):
												# The following sum varies between 148 and 156 on mps. Why?
												assert abs(result_sum.item() - 20.4125					) < 1e-2
												assert abs(result_mean.item() - 0.0266					) < 1e-3
								else:
												# CUDA
												assert abs(result_sum.item() - 20.4125					) < 1e-2
												assert abs(result_mean.item() - 0.0266					) < 1e-3






import math
from datetime import datetime, timedelta





def 		__A		(	__lowerCamelCase    )      ->       datetime:
	a										=							year % 19
	a										=							year % 4
	a										=							year % 7
	a										=							math.floor(year / 100    )
	a										=							math.floor((13 + 8 * leap_day_inhibits) / 25    )
	a										=							leap_day_inhibits / 4
	a										=							(
	    15 - lunar_orbit_correction + leap_day_inhibits - leap_day_reinstall_number
	) % 30
	a										=							(4 + leap_day_inhibits - leap_day_reinstall_number) % 7

	# days to be added to March 21
	a										=							(19 * metonic_cycle + secular_moon_shift) % 30

	# PHM -> Paschal Full Moon
	a										=							(
	    2 * julian_leap_year
	    + 4 * non_leap_year
	    + 6 * days_to_add
	    + century_starting_point
	) % 7

	if days_to_add == 29 and days_from_phm_to_sunday == 6:
		return datetime(__lowerCamelCase							,			4							,			19    )
	elif days_to_add == 28 and days_from_phm_to_sunday == 6:
		return datetime(__lowerCamelCase							,			4							,			18    )
	else:
		return datetime(__lowerCamelCase							,			3							,			22    ) + timedelta(
		    days=int(days_to_add + days_from_phm_to_sunday    )    )


if __name__ == "__main__":
		for year in (1_994, 2_000, 2_010, 2_021, 2_023):
				__UpperCamelCase					:       Tuple    					=      "will be" if year > datetime.now().year else "was"
				print(F'Easter in {year} {tense} {gauss_easter(year)}')

