"""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		(a_					,a_					,unittest.TestCase						):



    """simple docstring"""

    _UpperCAmelCase			:Union[str, Any]							=				IFImgaImgPipeline
    _UpperCAmelCase			:Any							=				TEXT_GUIDED_IMAGE_VARIATION_PARAMS - {'width', 'height'}
    _UpperCAmelCase			:Tuple							=				TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS
    _UpperCAmelCase			:int							=				PipelineTesterMixin.required_optional_params - {'latents'}






    def _snake_case    (     self							):
       return self._get_dummy_components()






    def _snake_case    (     self					,    _UpperCAmelCase					,    _UpperCAmelCase=0							):
       if str(_UpperCAmelCase							).startswith('''mps'''							):
          lowercase__:     str      =   torch.manual_seed(_UpperCAmelCase							)
       else:
          lowercase__:     Any      =   torch.Generator(device=_UpperCAmelCase							).manual_seed(_UpperCAmelCase							)

       lowercase__:     Tuple      =   floats_tensor((1, 3, 32, 32)					,    rng=random.Random(_UpperCAmelCase							)							).to(_UpperCAmelCase							)

       lowercase__:     List[str]      =   {
           '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							):
       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							):
       self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1e-3							)






    @unittest.skipIf(torch_device != '''cuda'''					,    reason='''float16 requires CUDA'''							)
    def _snake_case    (     self							):
       # 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							):
       super().test_floataa_inference(expected_max_diff=1e-1							)






    def _snake_case    (     self							):
       self._test_attention_slicing_forward_pass(expected_max_diff=1e-2							)






    def _snake_case    (     self							):
       self._test_save_load_local()






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

"""simple docstring"""






def SCREAMING_SNAKE_CASE__    (     __UpperCAmelCase				)						->						Optional[int]:
   lowercase__:     str      =   [7_0_1, 3_0_1, 1_3_2, 5_7, 2_3, 1_0, 4, 1]
   for gap in gaps:
      for i in range(__UpperCAmelCase ,					len(__UpperCAmelCase				)				):
         lowercase__:     Any      =   collection[i]
         lowercase__:     Tuple      =   i
         while j >= gap and collection[j - gap] > insert_value:
            lowercase__:     List[str]      =   collection[j - gap]
            j -= gap
         if j != i:
            lowercase__:     List[str]      =   insert_value
   return collection


if __name__ == "__main__":
       from doctest import testmod

       testmod()
       __A         =				input("Enter numbers separated by a comma:\n").strip()
       __A         =				[int(item) for item in user_input.split(",")]
       print(shell_sort(unsorted))
