





from collections.abc import Sequence

def   a_   (			lowerCAmelCase_				:      Sequence[float],     lowerCAmelCase_				:      bool = False     ):
   if not arr:
      return 0

   __lowerCAmelCase							     =     0 if allow_empty_subarrays else float('-inf'     )
   __lowerCAmelCase							     =     0.0
   for num in arr:
      __lowerCAmelCase							     =     max(0 if allow_empty_subarrays else num,     curr_sum + num     )
      __lowerCAmelCase							     =     max(lowerCAmelCase_,     lowerCAmelCase_     )

   return max_sum


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

     testmod()

     _snake_case  :   Optional[Any]						   =  [-2, 1, -3, 4, -1, 2, 1, -5, 4]
     print(F"""{max_subarray_sum(nums) = }""")








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

