'''simple docstring'''

import random
import unittest

import torch

from diffusers import IFInpaintingSuperResolutionPipeline
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						(						__lowerCamelCase ,				__lowerCamelCase ,				unittest.TestCase ):
   lowerCamelCase_    					=IFInpaintingSuperResolutionPipeline
   lowerCamelCase_    					=TEXT_GUIDED_IMAGE_INPAINTING_PARAMS - {'width', 'height'}
   lowerCamelCase_    					=TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS.union({'original_image'} )
   lowerCamelCase_    					=PipelineTesterMixin.required_optional_params - {'latents'}


   def __UpperCAmelCase       (   self				:	List[Any])      ->					Tuple:
         return self._get_superresolution_dummy_components()


   def __UpperCAmelCase       (   self				:	List[str]   ,		__lowerCAmelCase				:	List[Any]   ,		__lowerCAmelCase				:	Tuple=0)      ->					Tuple:
         if str(__lowerCAmelCase).startswith("mps"):
               lowercase_     =      torch.manual_seed(__lowerCAmelCase)
         else:
               lowercase_     =      torch.Generator(device=__lowerCAmelCase).manual_seed(__lowerCAmelCase)

         lowercase_     =      floats_tensor((1, 3, 16, 16)   ,		rng=random.Random(__lowerCAmelCase)).to(__lowerCAmelCase)
         lowercase_     =      floats_tensor((1, 3, 32, 32)   ,		rng=random.Random(__lowerCAmelCase)).to(__lowerCAmelCase)
         lowercase_     =      floats_tensor((1, 3, 32, 32)   ,		rng=random.Random(__lowerCAmelCase)).to(__lowerCAmelCase)

         lowercase_     =      {
             "prompt": "A painting of a squirrel eating a burger",
             "image": image,
             "original_image": original_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)      ->					Tuple:
         self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1e-3)


   def __UpperCAmelCase       (   self				:	int)      ->					List[Any]:
         self._test_save_load_optional_components()


   @unittest.skipIf(torch_device != "cuda"   ,		reason="float16 requires CUDA")
   def __UpperCAmelCase       (   self				:	Dict)      ->					List[str]:
         # 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 __UpperCAmelCase       (   self				:	List[str])      ->					int:
         self._test_attention_slicing_forward_pass(expected_max_diff=1e-2)


   def __UpperCAmelCase       (   self				:	int)      ->					Union[str, Any]:
         self._test_save_load_local()


   def __UpperCAmelCase       (   self				:	Optional[Any])      ->					str:
         self._test_inference_batch_single_identical(
             expected_max_diff=1e-2   ,		)







'''simple docstring'''

from __future__ import annotations


def __a (	__lowerCamelCase			:						int				)	->							list[int]:
      '''simple docstring'''


      lowercase_     =      [True] * limit
      lowercase_     =      False
      lowercase_     =      False
      lowercase_     =      True

      for i in range(3 ,		int(limit**0.5 + 1				) ,		2				):
            lowercase_     =      i * 2
            while index < limit:
                  lowercase_     =      False
                  lowercase_     =      index + i

      lowercase_     =      [2]

      for i in range(3 ,		__lowerCamelCase ,		2				):
            if is_prime[i]:
                  primes.append(__lowerCamelCase				)

      return primes


def __a (	__lowerCamelCase			:						int = 1_000_000				)	->							int:
      '''simple docstring'''


      lowercase_     =      prime_sieve(__lowerCamelCase				)
      lowercase_     =      0
      lowercase_     =      0

      for i in range(len(__lowerCamelCase				)				):
            for j in range(i + length ,		len(__lowerCamelCase				)				):
                  lowercase_     =      sum(primes[i:j]				)
                  if sol >= ceiling:
                        break

                  if sol in primes:
                        lowercase_     =      j - i
                        lowercase_     =      sol

      return largest


if __name__ == "__main__":
       print(F'''{solution() = }''')






