





import random
import unittest

import torch

from diffusers import IFInpaintingPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device

from ..pipeline_params import (
    TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS,
    TEXT_GUIDED_IMAGE_INPAINTING_PARAMS,
)
from ..test_pipelines_common import PipelineTesterMixin
from . import IFPipelineTesterMixin






@skip_mps
class  lowercase    (      __lowercase ,					__lowercase ,					unittest.TestCase       ):






					"""simple docstring"""



					snake_case_						  =			IFInpaintingPipeline
					snake_case_						  =			TEXT_GUIDED_IMAGE_INPAINTING_PARAMS - {'width', 'height'}
					snake_case_						  =			TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS
					snake_case_						  =			PipelineTesterMixin.required_optional_params - {'latents'}





					def       _UpperCamelCase       (    self						:     List[str]							):

						"""simple docstring"""



						return self._get_dummy_components()





					def       _UpperCamelCase       (    self						:     Any ,					a_						:     Optional[int] ,					a_						:     str=0							):

						"""simple docstring"""



						if str(a_							).startswith("""mps"""							):
							lowerCamelCase__										=			torch.manual_seed(a_							)
						else:
							lowerCamelCase__										=			torch.Generator(device=a_							).manual_seed(a_							)

						lowerCamelCase__										=			floats_tensor((1, 3, 32, 32) ,					rng=random.Random(a_							)							).to(a_							)
						lowerCamelCase__										=			floats_tensor((1, 3, 32, 32) ,					rng=random.Random(a_							)							).to(a_							)

						lowerCamelCase__										=			{
						    "prompt": "A painting of a squirrel eating a burger",
						    "image": image,
						    "mask_image": mask_image,
						    "generator": generator,
						    "num_inference_steps": 2,
						    "output_type": "numpy",
						}

						return inputs





					@unittest.skipIf(
					    torch_device != """cuda""" or not is_xformers_available() ,					reason="""XFormers attention is only available with CUDA and `xformers` installed""" ,					)
					def       _UpperCamelCase       (    self						:     Any							):

						"""simple docstring"""



						self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1e-3							)





					def       _UpperCamelCase       (    self						:     int							):

						"""simple docstring"""



						self._test_save_load_optional_components()





					@unittest.skipIf(torch_device != """cuda""" ,					reason="""float16 requires CUDA"""							)
					def       _UpperCamelCase       (    self						:     List[str]							):

						"""simple docstring"""



						super().test_save_load_floataa(expected_max_diff=1e-1							)





					def       _UpperCamelCase       (    self						:     int							):

						"""simple docstring"""



						self._test_attention_slicing_forward_pass(expected_max_diff=1e-2							)





					def       _UpperCamelCase       (    self						:     List[Any]							):

						"""simple docstring"""



						self._test_save_load_local()





					def       _UpperCamelCase       (    self						:     Tuple							):

						"""simple docstring"""



						self._test_inference_batch_single_identical(
						    expected_max_diff=1e-2 ,					)


def       _SCREAMING_SNAKE_CASE   (						_lowerCamelCase					:     int)   ->       int:






							'''simple docstring'''





							__UpperCamelCase      :  Tuple       =   1
							for i in range(1		,    num + 1):
														fact *= i
							return fact




def       _SCREAMING_SNAKE_CASE   (						_lowerCamelCase					:     int)   ->       int:






							'''simple docstring'''





							__UpperCamelCase      :  Dict       =   0
							while number > 0:
														__UpperCamelCase      :  List[Any]       =   number % 10
														sum_of_digits += last_digit
														__UpperCamelCase      :  List[Any]       =   number // 10  # Removing the last_digit from the given number
							return sum_of_digits




def       _SCREAMING_SNAKE_CASE   (						_lowerCamelCase					:     int = 100)   ->       int:






							'''simple docstring'''





							__UpperCamelCase      :  Optional[Any]       =   factorial(_lowerCamelCase)
							__UpperCamelCase      :  Tuple       =   split_and_add(_lowerCamelCase)
							return result


if __name__ == "__main__":
		print(solution(int(input('Enter the Number: ').strip())))