


'''simple docstring'''





from __future__ import annotations





def __UpperCAmelCase       (		__A ,						__A			)						->					Optional[Any]:



       '''simple docstring'''





       print(F"""Vertex\tShortest Distance from vertex {src}"""			)
       for i, d in enumerate(__A			):
              print(F"""{i}\t\t{d}"""			)





def __UpperCAmelCase       (		__A ,						__A ,						__A			)						->					int:



       '''simple docstring'''





       for j in range(__A			):
              UpperCAmelCase__						,			UpperCAmelCase__						,			UpperCAmelCase__										=     (graph[j][k] for k in ["src", "dst", "weight"])
              if distance[u] != float("inf"			) and distance[u] + w < distance[v]:
                     return True
       return False





def __UpperCAmelCase       (		__A ,						__A ,						__A ,						__A			)						->					list[float]:



       '''simple docstring'''





       UpperCAmelCase__										=     [float("inf"			)] * vertex_count
       UpperCAmelCase__										=     0.0

       for _ in range(vertex_count - 1			):
              for j in range(__A			):
                     UpperCAmelCase__						,			UpperCAmelCase__						,			UpperCAmelCase__										=     (graph[j][k] for k in ["src", "dst", "weight"])

                     if distance[u] != float("inf"			) and distance[u] + w < distance[v]:
                            UpperCAmelCase__										=     distance[u] + w

       UpperCAmelCase__										=     check_negative_cycle(__A ,						__A ,						__A			)
       if negative_cycle_exists:
              raise Exception("Negative cycle found"			)

       return distance


if __name__ == "__main__":
    import doctest

    doctest.testmod()

    A      = int(input("Enter number of vertices: ").strip())
    A      = int(input("Enter number of edges: ").strip())

    A      = [{} for _ in range(E)]

    for i in range(E):
        print("Edge ", i + 1)
        A, A, A      = (
            int(x)
            for x in input("Enter source, destination, weight: ").strip().split(" ")
        )
        A      = {"src": src, "dst": dest, "weight": weight}

    A      = int(input("\nEnter shortest path source:").strip())
    A      = bellman_ford(graph, V, E, source)
    print_distance(shortest_distance, 0)









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






  @property
  def 			_UpperCAmelCase  (					self      :					Union[str, Any] ):




         """simple docstring"""







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






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




         """simple docstring"""







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






  def 			_UpperCAmelCase  (					self      :					Dict ):




         """simple docstring"""







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

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

         UpperCAmelCase__										=     np.random.RandomState(0 )
         UpperCAmelCase__										=     pipe(
             prompt=_lowercase		,						image=_lowercase		,						mask_image=_lowercase		,						strength=0.7_5		,						guidance_scale=7.5		,						num_inference_steps=15		,						generator=_lowercase		,						output_type="np"		,						)

         UpperCAmelCase__										=     output.images[0]

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





