


"""simple docstring"""



import unittest

import numpy as np
import torch

from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel
from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device


enable_full_determinism()







class    __a						( unittest.TestCase							):







				@property
				def      lowerCamelCase_     ( self   ):

					'''simple docstring'''






					torch.manual_seed(0   )
					lowerCAmelCase_      							=			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      lowerCamelCase_     ( self   ):

					'''simple docstring'''






					lowerCAmelCase_      							=			self.dummy_uncond_unet
					lowerCAmelCase_      							=			KarrasVeScheduler()

					lowerCAmelCase_      							=			KarrasVePipeline(unet=UpperCAmelCase      ,	scheduler=UpperCAmelCase   )
					pipe.to(UpperCAmelCase   )
					pipe.set_progress_bar_config(disable=UpperCAmelCase   )

					lowerCAmelCase_      							=			torch.manual_seed(0   )
					lowerCAmelCase_      							=			pipe(num_inference_steps=2      ,	generator=UpperCAmelCase      ,	output_type='''numpy'''   ).images

					lowerCAmelCase_      							=			torch.manual_seed(0   )
					lowerCAmelCase_      							=			pipe(num_inference_steps=2      ,	generator=UpperCAmelCase      ,	output_type='''numpy'''      ,	return_dict=UpperCAmelCase   )[0]

					lowerCAmelCase_      							=			image[0, -3:, -3:, -1]
					lowerCAmelCase_      							=			image_from_tuple[0, -3:, -3:, -1]

					assert image.shape == (1, 32, 32, 3)
					lowerCAmelCase_      							=			np.array([0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0]   )

					assert np.abs(image_slice.flatten() - expected_slice   ).max() < 1E-2
					assert np.abs(image_from_tuple_slice.flatten() - expected_slice   ).max() < 1E-2







@slow
@require_torch
class    __a						( unittest.TestCase							):







				def      lowerCamelCase_     ( self   ):

					'''simple docstring'''






					lowerCAmelCase_      							=			'''google/ncsnpp-celebahq-256'''
					lowerCAmelCase_      							=			UNetaDModel.from_pretrained(UpperCAmelCase   )
					lowerCAmelCase_      							=			KarrasVeScheduler()

					lowerCAmelCase_      							=			KarrasVePipeline(unet=UpperCAmelCase      ,	scheduler=UpperCAmelCase   )
					pipe.to(UpperCAmelCase   )
					pipe.set_progress_bar_config(disable=UpperCAmelCase   )

					lowerCAmelCase_      							=			torch.manual_seed(0   )
					lowerCAmelCase_      							=			pipe(num_inference_steps=20      ,	generator=UpperCAmelCase      ,	output_type='''numpy'''   ).images

					lowerCAmelCase_      							=			image[0, -3:, -3:, -1]
					assert image.shape == (1, 256, 256, 3)
					lowerCAmelCase_      							=			np.array([0.5_7_8, 0.5_8_1_1, 0.5_9_2_4, 0.5_8_0_9, 0.5_8_7, 0.5_8_8_6, 0.5_8_6_1, 0.5_8_0_2, 0.5_8_6]   )

					assert np.abs(image_slice.flatten() - expected_slice   ).max() < 1E-2



"""simple docstring"""



import math
from datetime import datetime, timedelta
def      UpperCAmelCase     (       _lowercase :   int	)						-> datetime:


	"""simple docstring"""




	lowerCAmelCase_      							=			year % 1_9
	lowerCAmelCase_      							=			year % 4
	lowerCAmelCase_      							=			year % 7
	lowerCAmelCase_      							=			math.floor(year / 1_0_0	)
	lowerCAmelCase_      							=			math.floor((1_3 + 8 * leap_day_inhibits) / 2_5	)
	lowerCAmelCase_      							=			leap_day_inhibits / 4
	lowerCAmelCase_      							=			(
	    1_5 - lunar_orbit_correction + leap_day_inhibits - leap_day_reinstall_number
	) % 3_0
	lowerCAmelCase_      							=			(4 + leap_day_inhibits - leap_day_reinstall_number) % 7

	# days to be added to March 21
	lowerCAmelCase_      							=			(1_9 * metonic_cycle + secular_moon_shift) % 3_0

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

	if days_to_add == 2_9 and days_from_phm_to_sunday == 6:
		return datetime(_lowercase			,   4			,   1_9	)
	elif days_to_add == 2_8 and days_from_phm_to_sunday == 6:
		return datetime(_lowercase			,   4			,   1_8	)
	else:
		return datetime(_lowercase			,   3			,   2_2	) + timedelta(
		    days=int(days_to_add + days_from_phm_to_sunday	)	)


if __name__ == "__main__":
		for year in (19_94, 20_00, 20_10, 20_21, 20_23):
				lowercase_							=							'will be' if year > datetime.now().year else 'was'
				print(f"""Easter in {year} {tense} {gauss_easter(year)}""")