




'''simple docstring'''
import random
import unittest

import torch

from diffusers import IFImgaImgPipeline
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_VARIATION_BATCH_PARAMS,
    TEXT_GUIDED_IMAGE_VARIATION_PARAMS,
)
from ..test_pipelines_common import PipelineTesterMixin
from . import IFPipelineTesterMixin
@skip_mps
class      __UpperCAmelCase							(    lowerCAmelCase ,lowerCAmelCase ,unittest.TestCase							):



					'''simple docstring'''





					_UpperCamelCase  	=		IFImgaImgPipeline
					_UpperCamelCase  	=		TEXT_GUIDED_IMAGE_VARIATION_PARAMS - {"""width""", """height"""}
					_UpperCamelCase  	=		TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS
					_UpperCamelCase  	=		PipelineTesterMixin.required_optional_params - {"""latents"""}



					def 						__snake_case	(  self    :	Optional[Any])						->       Optional[int]:
								return self._get_dummy_components()



					def 						__snake_case	(  self    :	List[str]			,					_lowercase    :	Union[str, Any]			,					_lowercase    :	List[str]=0)						->       Any:
								if str(_lowercase).startswith('mps'):
											A_       		=   torch.manual_seed(_lowercase)
								else:
											A_       		=   torch.Generator(device=_lowercase).manual_seed(_lowercase)

								A_       		=   floats_tensor((1, 3, 32, 32)			,					rng=random.Random(_lowercase)).to(_lowercase)

								A_       		=   {
								    'prompt': 'A painting of a squirrel eating a burger',
								    'image': image,
								    'generator': generator,
								    'num_inference_steps': 2,
								    'output_type': 'numpy',
								}

								return inputs



					def 						__snake_case	(  self    :	Optional[Any])						->       Tuple:
								self._test_save_load_optional_components()



					@unittest.skipIf(
					    torch_device != 'cuda' or not is_xformers_available()			,					reason='XFormers attention is only available with CUDA and `xformers` installed'			,					)
					def 						__snake_case	(  self    :	Optional[Any])						->       Optional[int]:
								self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1E-3)



					@unittest.skipIf(torch_device != 'cuda'			,					reason='float16 requires CUDA')
					def 						__snake_case	(  self    :	Tuple)						->       Tuple:
								# Due to non-determinism in save load of the hf-internal-testing/tiny-random-t5 text encoder
								super().test_save_load_floataa(expected_max_diff=1E-1)



					@unittest.skipIf(torch_device != 'cuda'			,					reason='float16 requires CUDA')
					def 						__snake_case	(  self    :	List[Any])						->       Optional[Any]:
								super().test_floataa_inference(expected_max_diff=1E-1)



					def 						__snake_case	(  self    :	Optional[int])						->       Any:
								self._test_attention_slicing_forward_pass(expected_max_diff=1E-2)



					def 						__snake_case	(  self    :	Optional[Any])						->       Optional[Any]:
								self._test_save_load_local()



					def 						__snake_case	(  self    :	int)						->       Optional[int]:
								self._test_inference_batch_single_identical(
								    expected_max_diff=1E-2			,					)










'''simple docstring'''
from __future__ import annotations

import sys





def  lowerCamelCase(       SCREAMING_SNAKE_CASE_					,SCREAMING_SNAKE_CASE_    )		->		tuple[int, int]:
			# base cases
			if abs(SCREAMING_SNAKE_CASE_    ) == 1:
						return a, 0
			elif abs(SCREAMING_SNAKE_CASE_    ) == 1:
						return 0, b

			A_		,   A_       		=   a, b
			A_		,   A_       		=   1, 0
			A_		,   A_       		=   0, 1

			while remainder != 0:
						A_       		=   old_remainder // remainder
						A_		,   A_       		=   remainder, old_remainder - quotient * remainder
						A_		,   A_       		=   coeff_a, old_coeff_a - quotient * coeff_a
						A_		,   A_       		=   coeff_b, old_coeff_b - quotient * coeff_b

			# sign correction for negative numbers
			if a < 0:
						A_       		=   -old_coeff_a
			if b < 0:
						A_       		=   -old_coeff_b

			return old_coeff_a, old_coeff_b





def  lowerCamelCase(       )		->		Tuple:
			if len(sys.argv    ) < 3:
						print('2 integer arguments required'    )
						return 1
			A_       		=   int(sys.argv[1]    )
			A_       		=   int(sys.argv[2]    )
			print(extended_euclidean_algorithm(SCREAMING_SNAKE_CASE_					,SCREAMING_SNAKE_CASE_    )    )
			return 0


if __name__ == "__main__":
							raise SystemExit(main())




