

'''simple docstring'''



from typing import Any

import numpy as np
def 						__lowerCamelCase       (   __snake_case     :		np.ndarray       )       ->							List[Any]:






						"""simple docstring"""





						return np.array_equal(snake_case__,		matrix.conjugate().T       )
def 						__lowerCamelCase       (   __snake_case     :		np.ndarray,		__snake_case     :		np.ndarray       )       ->							Optional[int]:






						"""simple docstring"""





						A__     :   Optional[int]      =v.conjugate().T
						A__     :   List[Any]      =v_star.dot(snake_case__       )
						assert isinstance(snake_case__,		np.ndarray       )
						return (v_star_dot.dot(snake_case__       )) / (v_star.dot(snake_case__       ))
def 						__lowerCamelCase       (   )       ->							Optional[Any]:






						"""simple docstring"""





						A__     :   int      =np.array([[2, 2 + 1j, 4], [2 - 1j, 3, 1j], [4, -1j, 1]]       )
						A__     :   int      =np.array([[1], [2], [3]]       )
						assert is_hermitian(snake_case__       ), f"{a} is not hermitian."
						print(rayleigh_quotient(snake_case__,		snake_case__       )       )

						A__     :   int      =np.array([[1, 2, 4], [2, 3, -1], [4, -1, 1]]       )
						assert is_hermitian(snake_case__       ), f"{a} is not hermitian."
						assert rayleigh_quotient(snake_case__,		snake_case__       ) == float(3       )


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		tests()







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







 '''simple docstring'''





 @property
 def  UpperCamelCase_   (				self:		Optional[Any]		):




   '''simple docstring'''



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


 @property
 def  UpperCamelCase_   (				self:		int		):




   '''simple docstring'''



   _snake_case							:		Any								=  ort.SessionOptions()
   _snake_case							:		Union[str, Any]								=  False
   return options


 def  UpperCamelCase_   (				self:		List[Any]		):




   '''simple docstring'''



   _snake_case							:		Any								=  load_image(
       """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"""
       """/in_paint/overture-creations-5sI6fQgYIuo.png"""		)
   _snake_case							:		Union[str, Any]								=  load_image(
       """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"""
       """/in_paint/overture-creations-5sI6fQgYIuo_mask.png"""		)
   _snake_case							:		Union[str, 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
   _snake_case							:		Optional[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_		)

   _snake_case							:		Optional[Any]								=  """A red cat sitting on a park bench"""

   _snake_case							:		Optional[int]								=  np.random.RandomState(0		)
   _snake_case							:		Any								=  pipe(
       prompt=a_,      image=a_,      mask_image=a_,      strength=0.75,      guidance_scale=7.5,      num_inference_steps=15,      generator=a_,      output_type="""np""",      )

   _snake_case							:		Dict								=  output.images[0]

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


