

"""simple docstring"""






import unittest

import numpy as np

from diffusers import OnnxStableDiffusionInpaintPipelineLegacy
from diffusers.utils.testing_utils import (
    is_onnx_available,
    load_image,
    load_numpy,
    nightly,
    require_onnxruntime,
    require_torch_gpu,
)


if is_onnx_available():
 import onnxruntime as ort







@nightly
@require_onnxruntime
@require_torch_gpu
class 	__UpperCamelCase    (    unittest.TestCase						):

  @property
  def __lowerCamelCase		(		self      ):
      '''simple docstring'''

      return (
          "CUDAExecutionProvider",
          {
              "gpu_mem_limit": "15000000000",  # 15GB
              "arena_extend_strategy": "kSameAsRequested",
          },
      )

  @property
  def __lowerCamelCase		(		self      ):
      '''simple docstring'''

      _lowerCAmelCase       :   List[Any]  =    ort.SessionOptions()
      _lowerCAmelCase       :   List[Any]  =    False
      return options







  def __lowerCamelCase		(		self      ):
      '''simple docstring'''

      _lowerCAmelCase       :   List[Any]  =    load_image(
          'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'
          '/in_paint/overture-creations-5sI6fQgYIuo.png'      )
      _lowerCAmelCase       :   Union[str, Any]  =    load_image(
          'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'
          '/in_paint/overture-creations-5sI6fQgYIuo_mask.png'      )
      _lowerCAmelCase       :   Optional[Any]  =    load_numpy(
          'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'
          '/in_paint/red_cat_sitting_on_a_park_bench_onnx.npy'      )

      # using the PNDM scheduler by default
      _lowerCAmelCase       :   List[Any]  =    OnnxStableDiffusionInpaintPipelineLegacy.from_pretrained(
          'CompVis/stable-diffusion-v1-4'    ,revision='onnx'    ,safety_checker=_A    ,feature_extractor=_A    ,provider=self.gpu_provider    ,sess_options=self.gpu_options    ,)
      pipe.set_progress_bar_config(disable=_A      )

      _lowerCAmelCase       :   List[Any]  =    'A red cat sitting on a park bench'

      _lowerCAmelCase       :   Union[str, Any]  =    np.random.RandomState(0      )
      _lowerCAmelCase       :   Any  =    pipe(
          prompt=_A    ,image=_A    ,mask_image=_A    ,strength=0.7_5    ,guidance_scale=7.5    ,num_inference_steps=15    ,generator=_A    ,output_type='np'    ,)

      _lowerCAmelCase       :   int  =    output.images[0]

      assert image.shape == (512, 512, 3)
      assert np.abs(expected_image - image      ).max() < 1E-2








"""simple docstring"""






from __future__ import annotations

def 		lowerCamelCase__		(					_lowerCamelCase   ):

    '''simple docstring'''



    create_state_space_tree(_lowerCamelCase ,   [] ,   0 ,   [0 for i in range(len(_lowerCamelCase   )   )]   )

def 		lowerCamelCase__		(					_lowerCamelCase ,   _lowerCamelCase ,   _lowerCamelCase ,   _lowerCamelCase ,   ):

    '''simple docstring'''



    if index == len(_lowerCamelCase   ):
        print(_lowerCamelCase   )
        return

    for i in range(len(_lowerCamelCase   )   ):
        if not index_used[i]:
            current_sequence.append(sequence[i]   )
            _lowerCAmelCase       :   List[str]  =    True
            create_state_space_tree(_lowerCamelCase ,   _lowerCamelCase ,   index + 1 ,   _lowerCamelCase   )
            current_sequence.pop()
            _lowerCAmelCase       :   int  =    False
_lowerCAmelCase						=		[3, 1, 2, 4]
generate_all_permutations(sequence)

_lowerCAmelCase						=		["A", "B", "C"]

generate_all_permutations(sequence_a)





