
'''simple docstring'''






import unittest

import numpy as np
import torch

from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel
from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device


enable_full_determinism()




class     __snake_case		(   unittest.TestCase):
					@property
					def     UpperCAmelCase_							(     self      ):

									"""simple docstring"""


									torch.manual_seed(0      )
									lowerCamelCase					:			Dict									= 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      ):

									"""simple docstring"""


									lowerCamelCase					:			List[Any]									= self.dummy_uncond_unet
									lowerCamelCase					:			str									= PNDMScheduler()

									lowerCamelCase					:			str									= PNDMPipeline(unet=A,    scheduler=A      )
									pndm.to(A      )
									pndm.set_progress_bar_config(disable=A      )

									lowerCamelCase					:			int									= torch.manual_seed(0      )
									lowerCamelCase					:			List[Any]									= pndm(generator=A,    num_inference_steps=20,    output_type='numpy'      ).images

									lowerCamelCase					:			Optional[int]									= torch.manual_seed(0      )
									lowerCamelCase					:			Any									= pndm(generator=A,    num_inference_steps=20,    output_type='numpy',    return_dict=A      )[0]

									lowerCamelCase					:			Dict									= image[0, -3:, -3:, -1]
									lowerCamelCase					:			Any									= image_from_tuple[0, -3:, -3:, -1]

									assert image.shape == (1, 32, 32, 3)
									lowerCamelCase					:			List[str]									= np.array([1.0, 1.0, 0.0, 1.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     __snake_case		(   unittest.TestCase):
					def     UpperCAmelCase_							(     self      ):

									"""simple docstring"""


									lowerCamelCase					:			Dict									= 'google/ddpm-cifar10-32'

									lowerCamelCase					:			int									= UNetaDModel.from_pretrained(A      )
									lowerCamelCase					:			Optional[Any]									= PNDMScheduler()

									lowerCamelCase					:			str									= PNDMPipeline(unet=A,    scheduler=A      )
									pndm.to(A      )
									pndm.set_progress_bar_config(disable=A      )
									lowerCamelCase					:			Dict									= torch.manual_seed(0      )
									lowerCamelCase					:			Tuple									= pndm(generator=A,    output_type='numpy'      ).images

									lowerCamelCase					:			Any									= image[0, -3:, -3:, -1]

									assert image.shape == (1, 32, 32, 3)
									lowerCamelCase					:			Optional[int]									= np.array([0.1564, 0.1_4645, 0.1406, 0.1_4715, 0.1_2425, 0.1_4045, 0.1_3115, 0.1_2175, 0.125]      )

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


'''simple docstring'''






def    UpperCAmelCase							(  UpperCAmelCase__							:							int = 10_00):
				lowerCamelCase					:			Optional[Any]									= 2**power
				lowerCamelCase					:			str									= str(UpperCAmelCase__)
				lowerCamelCase					:			Union[str, Any]									= list(UpperCAmelCase__)
				lowerCamelCase					:			Optional[Any]									= 0

				for i in list_num:
								sum_of_num += int(UpperCAmelCase__)

				return sum_of_num


if __name__ == "__main__":
					A			      =      int(input('Enter the power of 2: ').strip())
					print('2 ^ ', power, ' = ', 2**power)
					A			      =      solution(power)
					print('Sum of the digits is: ', result)
