





import math
import unittest

def   a_   (			lowerCAmelCase_				:      int     ):
   assert isinstance(lowerCAmelCase_,     lowerCAmelCase_     ) and (
       number >= 0
   ), "'number' must been an int and positive"

   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(lowerCAmelCase_     ) + 1     ),     6     ):
      if number % i == 0 or number % (i + 2) == 0:
         return False
   return True



class     _UpperCAmelCase   (   unittest.TestCase   ):

  """simple docstring"""


  def     lowercase		(    self			:		Dict					)							->						Optional[Any]:
     self.assertTrue(is_prime(2					)					)
     self.assertTrue(is_prime(3					)					)
     self.assertTrue(is_prime(5					)					)
     self.assertTrue(is_prime(7					)					)
     self.assertTrue(is_prime(1_1					)					)
     self.assertTrue(is_prime(1_3					)					)
     self.assertTrue(is_prime(1_7					)					)
     self.assertTrue(is_prime(1_9					)					)
     self.assertTrue(is_prime(2_3					)					)
     self.assertTrue(is_prime(2_9					)					)






  def     lowercase		(    self			:		str					)							->						int:
     with self.assertRaises(lowerCAmelCase_					):
        is_prime(-1_9					)
     self.assertFalse(
         is_prime(0					) ,  'Zero doesn\'t have any positive factors, primes must have exactly two.' ,  )
     self.assertFalse(
         is_prime(1					) ,  'One only has 1 positive factor, primes must have exactly two.' ,  )
     self.assertFalse(is_prime(2 * 2					)					)
     self.assertFalse(is_prime(2 * 3					)					)
     self.assertFalse(is_prime(3 * 3					)					)
     self.assertFalse(is_prime(3 * 5					)					)
     self.assertFalse(is_prime(3 * 5 * 7					)					)


if __name__ == "__main__":
     unittest.main()








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   ):

  """simple docstring"""


  @property
  def     lowercase		(    self			:		Union[str, Any]					)							->						Tuple:
     return (
         "CUDAExecutionProvider",
         {
             "gpu_mem_limit": "15000000000",  # 15GB
             "arena_extend_strategy": "kSameAsRequested",
         },
     )






  @property
  def     lowercase		(    self			:		List[Any]					)							->						int:
     __lowerCAmelCase							     =     ort.SessionOptions()
     __lowerCAmelCase							     =     False
     return options






  def     lowercase		(    self			:		Tuple					)							->						List[Any]:
     __lowerCAmelCase							     =     load_image(
         'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'
         '/in_paint/overture-creations-5sI6fQgYIuo.png'					)
     __lowerCAmelCase							     =     load_image(
         'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'
         '/in_paint/overture-creations-5sI6fQgYIuo_mask.png'					)
     __lowerCAmelCase							     =     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							     =     OnnxStableDiffusionInpaintPipelineLegacy.from_pretrained(
         'CompVis/stable-diffusion-v1-4' ,  revision='onnx' ,  safety_checker=lowerCAmelCase_ ,  feature_extractor=lowerCAmelCase_ ,  provider=self.gpu_provider ,  sess_options=self.gpu_options ,  )
     pipe.set_progress_bar_config(disable=lowerCAmelCase_					)

     __lowerCAmelCase							     =     'A red cat sitting on a park bench'

     __lowerCAmelCase							     =     np.random.RandomState(0					)
     __lowerCAmelCase							     =     pipe(
         prompt=lowerCAmelCase_ ,  image=lowerCAmelCase_ ,  mask_image=lowerCAmelCase_ ,  strength=0.75 ,  guidance_scale=7.5 ,  num_inference_steps=1_5 ,  generator=lowerCAmelCase_ ,  output_type='np' ,  )

     __lowerCAmelCase							     =     output.images[0]

     assert image.shape == (5_1_2, 5_1_2, 3)
     assert np.abs(expected_image - image					).max() < 1e-2

