code: 
  
  
  
  
  
  import random
  import unittest
  
  import torch
  
  from diffusers import IFSuperResolutionPipeline
  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	(   _lowercase ,       _lowercase ,       unittest.TestCase					):
  					__A          =   IFSuperResolutionPipeline
  					__A          =   TEXT_GUIDED_IMAGE_VARIATION_PARAMS - {"width", "height"}
  					__A          =   TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS
  					__A          =   PipelineTesterMixin.required_optional_params - {"latents"}
  
  
  
  
  					def 	snake_case_		(						self       )						->  Tuple:
  							return self._get_superresolution_dummy_components()
  
  
  
  
  					def 	snake_case_		(						self    ,      __lowerCAmelCase    ,      __lowerCAmelCase=0       )						->  Dict:
  							if str(__lowerCAmelCase       ).startswith("""mps"""       ):
  									UpperCamelCase__         =	torch.manual_seed(__lowerCAmelCase       )
  							else:
  									UpperCamelCase__         =	torch.Generator(device=__lowerCAmelCase       ).manual_seed(__lowerCAmelCase       )
  
  							UpperCamelCase__         =	floats_tensor((1, 3, 32, 32)    ,      rng=random.Random(__lowerCAmelCase       )       ).to(__lowerCAmelCase       )
  
  							UpperCamelCase__         =	{
  							    """prompt""": """A painting of a squirrel eating a burger""",
  							    """image""": 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 	snake_case_		(						self       )						->  Tuple:
  							self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1E-3       )
  
  
  
  
  					def 	snake_case_		(						self       )						->  Optional[Any]:
  							self._test_save_load_optional_components()
  
  
  
  
  					@unittest.skipIf(torch_device != """cuda"""    ,      reason="""float16 requires CUDA"""       )
  					def 	snake_case_		(						self       )						->  Union[str, Any]:
  							# 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       )
  
  
  
  
  					def 	snake_case_		(						self       )						->  Tuple:
  							self._test_attention_slicing_forward_pass(expected_max_diff=1E-2       )
  
  
  
  
  					def 	snake_case_		(						self       )						->  Optional[int]:
  							self._test_save_load_local()
  
  
  
  
  					def 	snake_case_		(						self       )						->  Union[str, Any]:
  							self._test_inference_batch_single_identical(
  							    expected_max_diff=1E-2    ,      )
  
  
  
  
  
  
style_context: 
  
  
  
  
  
  def     a						(      _lowercase   :     int ,						_lowercase   :     int       )     ->int:
  		UpperCamelCase__         =	1.0
  		for i in range(1 ,						r + 1       ):
  				ret *= (n + 1 - i) / i
  		return round(_lowercase       )
  
  def     a						(      _lowercase   :     int       )     ->int:
  		return choose(8 + n ,						_lowercase       ) + choose(9 + n ,						_lowercase       ) - 1_0
  
  def     a						(      _lowercase   :     int       )     ->int:
  		return sum(non_bouncy_exact(_lowercase       ) for i in range(1 ,						n + 1       )       )
  
  def     a						(      _lowercase   :     int = 1_0_0       )     ->int:
  		return non_bouncy_upto(_lowercase       )
  
  
  if __name__ == "__main__":
  				print(f"""{solution() = }""")
  
  
  
  
  
  