import unittest

import numpy as np

from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline
from diffusers.utils.testing_utils import (
    is_onnx_available,
    load_image,
    nightly,
    require_onnxruntime,
    require_torch_gpu,
)

from ..test_pipelines_onnx_common import OnnxPipelineTesterMixin


if is_onnx_available():
							import onnxruntime as ort


class 						lowercase    (     a				,       unittest.TestCase     ):
							# FIXME: add fast tests
							pass



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




							@property
							def 	__snake_case(						self   :					Dict      )					->				Tuple:



												'''simple docstring'''

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




							@property
							def 	__snake_case(						self   :					List[str]      )					->				List[str]:



												'''simple docstring'''

												SCREAMING_SNAKE_CASE    			=       ort.SessionOptions()
												SCREAMING_SNAKE_CASE    			=       False
												return options




							def 	__snake_case(						self   :					List[str]      )					->				str:



												'''simple docstring'''

												SCREAMING_SNAKE_CASE    			=       load_image(
												    "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"
												    "/in_paint/overture-creations-5sI6fQgYIuo.png"      )
												SCREAMING_SNAKE_CASE    			=       load_image(
												    "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"
												    "/in_paint/overture-creations-5sI6fQgYIuo_mask.png"      )
												SCREAMING_SNAKE_CASE    			=       OnnxStableDiffusionInpaintPipeline.from_pretrained(
												    "runwayml/stable-diffusion-inpainting"	,							revision="onnx"	,							safety_checker=_UpperCamelCase	,							feature_extractor=_UpperCamelCase	,							provider=self.gpu_provider	,							sess_options=self.gpu_options	,							)
												pipe.set_progress_bar_config(disable=_UpperCamelCase      )

												SCREAMING_SNAKE_CASE    			=       "A red cat sitting on a park bench"

												SCREAMING_SNAKE_CASE    			=       np.random.RandomState(0      )
												SCREAMING_SNAKE_CASE    			=       pipe(
												    prompt=_UpperCamelCase	,							image=_UpperCamelCase	,							mask_image=_UpperCamelCase	,							guidance_scale=7.5	,							num_inference_steps=10	,							generator=_UpperCamelCase	,							output_type="np"	,							)
												SCREAMING_SNAKE_CASE    			=       output.images
												SCREAMING_SNAKE_CASE    			=       images[0, 255:258, 255:258, -1]

												assert images.shape == (1, 512, 512, 3)
												SCREAMING_SNAKE_CASE    			=       np.array([0.2_5_1_4, 0.3_0_0_7, 0.3_5_1_7, 0.1_7_9_0, 0.2_3_8_2, 0.3_1_6_7, 0.1_9_4_4, 0.2_2_7_3, 0.2_4_6_4]      )

												assert np.abs(image_slice.flatten() - expected_slice      ).max() < 1e-3





							def 	__snake_case(						self   :					Optional[Any]      )					->				Any:



												'''simple docstring'''

												SCREAMING_SNAKE_CASE    			=       load_image(
												    "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"
												    "/in_paint/overture-creations-5sI6fQgYIuo.png"      )
												SCREAMING_SNAKE_CASE    			=       load_image(
												    "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"
												    "/in_paint/overture-creations-5sI6fQgYIuo_mask.png"      )
												SCREAMING_SNAKE_CASE    			=       LMSDiscreteScheduler.from_pretrained(
												    "runwayml/stable-diffusion-inpainting"	,							subfolder="scheduler"	,							revision="onnx"      )
												SCREAMING_SNAKE_CASE    			=       OnnxStableDiffusionInpaintPipeline.from_pretrained(
												    "runwayml/stable-diffusion-inpainting"	,							revision="onnx"	,							scheduler=_UpperCamelCase	,							safety_checker=_UpperCamelCase	,							feature_extractor=_UpperCamelCase	,							provider=self.gpu_provider	,							sess_options=self.gpu_options	,							)
												pipe.set_progress_bar_config(disable=_UpperCamelCase      )

												SCREAMING_SNAKE_CASE    			=       "A red cat sitting on a park bench"

												SCREAMING_SNAKE_CASE    			=       np.random.RandomState(0      )
												SCREAMING_SNAKE_CASE    			=       pipe(
												    prompt=_UpperCamelCase	,							image=_UpperCamelCase	,							mask_image=_UpperCamelCase	,							guidance_scale=7.5	,							num_inference_steps=20	,							generator=_UpperCamelCase	,							output_type="np"	,							)
												SCREAMING_SNAKE_CASE    			=       output.images
												SCREAMING_SNAKE_CASE    			=       images[0, 255:258, 255:258, -1]

												assert images.shape == (1, 512, 512, 3)
												SCREAMING_SNAKE_CASE    			=       np.array([0.0_0_8_6, 0.0_0_7_7, 0.0_0_8_3, 0.0_0_9_3, 0.0_1_0_7, 0.0_1_3_9, 0.0_0_9_4, 0.0_0_9_7, 0.0_1_2_5]      )

												assert np.abs(image_slice.flatten() - expected_slice      ).max() < 1e-3





from __future__ import annotations

import math





def 	__lowerCamelCase							(UpperCAmelCase__     :							int  ):

					if 1 < number < 4:
										# 2 and 3 are primes
										return True
					elif number < 2 or number % 2 == 0 or number % 3 == 0:
										# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
										return False

					# All primes number are in format of 6k +/- 1
					for i in range(5      , int(math.sqrt(UpperCAmelCase__  ) + 1  )      , 6  ):
										if number % i == 0 or number % (i + 2) == 0:
															return False
					return True


_lowerCamelCase					:   Tuple							=		[num for num in range(3, 10_00_01, 2) if not is_prime(num)]





def 	__lowerCamelCase							(UpperCAmelCase__     :							int  ):
					if not isinstance(UpperCAmelCase__      , UpperCAmelCase__  ):
										raise ValueError("n must be an integer"  )
					if n <= 0:
										raise ValueError("n must be >= 0"  )

					SCREAMING_SNAKE_CASE    			=       []
					for num in range(len(UpperCAmelCase__  )  ):
										SCREAMING_SNAKE_CASE    			=       0
										while 2 * i * i <= odd_composites[num]:
															SCREAMING_SNAKE_CASE    			=       odd_composites[num] - 2 * i * i
															if is_prime(UpperCAmelCase__  ):
																				break
															i += 1
										else:
															list_nums.append(odd_composites[num]  )
															if len(UpperCAmelCase__  ) == n:
																				return list_nums

					return []





def 	__lowerCamelCase							():
					return compute_nums(1  )[0]


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




