code: 
  
  
  
  
  
  import unittest
  
  import numpy as np
  
  from transformers.testing_utils import require_torch, require_vision
  from transformers.utils import is_torch_available, is_vision_available
  
  from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs
  
  
  if is_torch_available():
     import torch
  
  if is_vision_available():
     from PIL import Image
  
     from transformers import OwlViTImageProcessor
  
  class 				A    (unittest.TestCase				):
  
  
  
        def __init__(					self     ,  lowercase_     ,  lowercase_=7     ,  lowercase_=3     ,  lowercase_=18     ,  lowercase_=30     ,  lowercase_=400     ,  lowercase_=True     ,  lowercase_=None     ,  lowercase_=True     ,  lowercase_=None     ,  lowercase_=True     ,  lowercase_=[0.4814_5466, 0.457_8275, 0.4082_1073]     ,  lowercase_=[0.2686_2954, 0.2613_0258, 0.2757_7711]     ,  lowercase_=True     ,  )      ->   Union[str, Any]:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							Optional[int]     				=						parent
               _snake_case      :							Any     				=						batch_size
               _snake_case      :							List[str]     				=						num_channels
               _snake_case      :							Optional[Any]     				=						image_size
               _snake_case      :							Tuple     				=						min_resolution
               _snake_case      :							Any     				=						max_resolution
               _snake_case      :							Dict     				=						do_resize
               _snake_case      :							Dict     				=						size if size is not None else {'''height''': 18, '''width''': 18}
               _snake_case      :							Dict     				=						do_center_crop
               _snake_case      :							Optional[int]     				=						crop_size if crop_size is not None else {'''height''': 18, '''width''': 18}
               _snake_case      :							int     				=						do_normalize
               _snake_case      :							List[str]     				=						image_mean
               _snake_case      :							Union[str, Any]     				=						image_std
               _snake_case      :							Optional[Any]     				=						do_convert_rgb
  
  
  
        def    __a (					self					)      ->   str:
  
  
  
               '''simple docstring'''
  
               return {
                   "do_resize": self.do_resize,
                   "size": self.size,
                   "do_center_crop": self.do_center_crop,
                   "crop_size": self.crop_size,
                   "do_normalize": self.do_normalize,
                   "image_mean": self.image_mean,
                   "image_std": self.image_std,
                   "do_convert_rgb": self.do_convert_rgb,
               }
  
  
  @require_torch
  @require_vision
  class 				A    (__UpperCAmelCase       ,unittest.TestCase				):
        _SCREAMING_SNAKE_CASE					=							OwlViTImageProcessor if is_vision_available() else None
  
  
  
        def    __a (					self					)      ->   Tuple:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							Any     				=						OwlViTImageProcessingTester(self					)
  
  
  
        @property
        def    __a (					self					)      ->   Optional[int]:
  
  
  
               '''simple docstring'''
  
               return self.image_processor_tester.prepare_image_processor_dict()
  
  
  
        def    __a (					self					)      ->   Any:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							Optional[int]     				=						self.image_processing_class(**self.image_processor_dict					)
               self.assertTrue(hasattr(lowercase_     ,  '''do_resize'''					)					)
               self.assertTrue(hasattr(lowercase_     ,  '''size'''					)					)
               self.assertTrue(hasattr(lowercase_     ,  '''do_center_crop'''					)					)
               self.assertTrue(hasattr(lowercase_     ,  '''center_crop'''					)					)
               self.assertTrue(hasattr(lowercase_     ,  '''do_normalize'''					)					)
               self.assertTrue(hasattr(lowercase_     ,  '''image_mean'''					)					)
               self.assertTrue(hasattr(lowercase_     ,  '''image_std'''					)					)
               self.assertTrue(hasattr(lowercase_     ,  '''do_convert_rgb'''					)					)
  
  
  
        def    __a (					self					)      ->   Optional[Any]:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							List[Any]     				=						self.image_processing_class.from_dict(self.image_processor_dict					)
               self.assertEqual(image_processor.size     ,  {'''height''': 18, '''width''': 18}					)
               self.assertEqual(image_processor.crop_size     ,  {'''height''': 18, '''width''': 18}					)
  
               _snake_case      :							str     				=						self.image_processing_class.from_dict(self.image_processor_dict     ,  size=42     ,  crop_size=84					)
               self.assertEqual(image_processor.size     ,  {'''height''': 42, '''width''': 42}					)
               self.assertEqual(image_processor.crop_size     ,  {'''height''': 84, '''width''': 84}					)
  
  
  
        def    __a (					self					)      ->   Any:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							Tuple     				=						self.image_processing_class(**self.image_processor_dict					)
               # create random PIL images
               _snake_case      :							Tuple     				=						prepare_image_inputs(self.image_processor_tester     ,  equal_resolution=lowercase_					)
  
               for image in image_inputs:
                      self.assertIsInstance(lowercase_     ,  Image.Image					)
  
               # Test not batched input
               _snake_case      :							Optional[int]     				=						image_processing(image_inputs[0]     ,  return_tensors='''pt'''					).pixel_values
               self.assertEqual(
                   encoded_images.shape     ,  (
                       1,
                       self.image_processor_tester.num_channels,
                       self.image_processor_tester.crop_size['''height'''],
                       self.image_processor_tester.crop_size['''width'''],
                   )     ,  )
  
               # Test batched
               _snake_case      :							Any     				=						image_processing(lowercase_     ,  return_tensors='''pt'''					).pixel_values
               self.assertEqual(
                   encoded_images.shape     ,  (
                       self.image_processor_tester.batch_size,
                       self.image_processor_tester.num_channels,
                       self.image_processor_tester.crop_size['''height'''],
                       self.image_processor_tester.crop_size['''width'''],
                   )     ,  )
  
  
  
        def    __a (					self					)      ->   List[str]:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							Optional[int]     				=						self.image_processing_class(**self.image_processor_dict					)
               # create random numpy tensors
               _snake_case      :							Tuple     				=						prepare_image_inputs(self.image_processor_tester     ,  equal_resolution=lowercase_     ,  numpify=lowercase_					)
               for image in image_inputs:
                      self.assertIsInstance(lowercase_     ,  np.ndarray					)
  
               # Test not batched input
               _snake_case      :							List[str]     				=						image_processing(image_inputs[0]     ,  return_tensors='''pt'''					).pixel_values
               self.assertEqual(
                   encoded_images.shape     ,  (
                       1,
                       self.image_processor_tester.num_channels,
                       self.image_processor_tester.crop_size['''height'''],
                       self.image_processor_tester.crop_size['''width'''],
                   )     ,  )
  
               # Test batched
               _snake_case      :							List[Any]     				=						image_processing(lowercase_     ,  return_tensors='''pt'''					).pixel_values
               self.assertEqual(
                   encoded_images.shape     ,  (
                       self.image_processor_tester.batch_size,
                       self.image_processor_tester.num_channels,
                       self.image_processor_tester.crop_size['''height'''],
                       self.image_processor_tester.crop_size['''width'''],
                   )     ,  )
  
  
  
        def    __a (					self					)      ->   Dict:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							Optional[Any]     				=						self.image_processing_class(**self.image_processor_dict					)
               # create random PyTorch tensors
               _snake_case      :							List[Any]     				=						prepare_image_inputs(self.image_processor_tester     ,  equal_resolution=lowercase_     ,  torchify=lowercase_					)
               for image in image_inputs:
                      self.assertIsInstance(lowercase_     ,  torch.Tensor					)
  
               # Test not batched input
               _snake_case      :							List[str]     				=						image_processing(image_inputs[0]     ,  return_tensors='''pt'''					).pixel_values
               self.assertEqual(
                   encoded_images.shape     ,  (
                       1,
                       self.image_processor_tester.num_channels,
                       self.image_processor_tester.crop_size['''height'''],
                       self.image_processor_tester.crop_size['''width'''],
                   )     ,  )
  
               # Test batched
               _snake_case      :							Any     				=						image_processing(lowercase_     ,  return_tensors='''pt'''					).pixel_values
               self.assertEqual(
                   encoded_images.shape     ,  (
                       self.image_processor_tester.batch_size,
                       self.image_processor_tester.num_channels,
                       self.image_processor_tester.crop_size['''height'''],
                       self.image_processor_tester.crop_size['''width'''],
                   )     ,  )
  
  
  
  
  
  
  
style_context: 
  
  
  
  
  
  from __future__ import annotations
  
  class 				A    :
  
  
  
        def __init__(					self     ,  lowercase_					)      ->   None:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							Optional[Any]     				=						vertices
               _snake_case      :							int     				=						[[0] * vertices for _ in range(lowercase_					)]
  
  
  
        def    __a (					self     ,  lowercase_					)      ->   None:
  
  
  
               '''simple docstring'''
  
               print('''Vertex \t Distance from Source'''					)
               for vertex in range(self.vertices					):
                      print(lowercase_     ,  '''\t\t'''     ,  distances_from_source[vertex]					)
  
  
  
        def    __a (					self     ,  lowercase_     ,  lowercase_					)      ->   int:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							List[Any]     				=						1E7
               _snake_case      :							Tuple     				=						0
  
               # Search not nearest vertex not in the shortest path tree
               for vertex in range(self.vertices					):
                      if distances_from_source[vertex] < minimum and visited[vertex] is False:
                             _snake_case      :							Dict     				=						distances_from_source[vertex]
                             _snake_case      :							int     				=						vertex
               return min_index
  
  
  
        def    __a (					self     ,  lowercase_					)      ->   None:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							List[Any]     				=						[int(1E7					)] * self.vertices  # distances from the source
               _snake_case      :							List[Any]     				=						0
               _snake_case      :							List[str]     				=						[False] * self.vertices
  
               for _ in range(self.vertices					):
                      _snake_case      :							List[Any]     				=						self.minimum_distance(lowercase_     ,  lowercase_					)
                      _snake_case      :							List[str]     				=						True
  
                      # Update dist value of the adjacent vertices
                      # of the picked vertex only if the current
                      # distance is greater than new distance and
                      # the vertex in not in the shortest path tree
                      for v in range(self.vertices					):
                             if (
                                 self.graph[u][v] > 0
                                 and visited[v] is False
                                 and distances[v] > distances[u] + self.graph[u][v]
                             ):
                                    _snake_case      :							Any     				=						distances[u] + self.graph[u][v]
  
               self.print_solution(lowercase_					)
  
  
  if __name__ == "__main__":
     lowerCAmelCase_   =   Graph(9)
     lowerCAmelCase_   =   [
         [0, 4, 0, 0, 0, 0, 0, 8, 0],
         [4, 0, 8, 0, 0, 0, 0, 1_1, 0],
         [0, 8, 0, 7, 0, 4, 0, 0, 2],
         [0, 0, 7, 0, 9, 1_4, 0, 0, 0],
         [0, 0, 0, 9, 0, 1_0, 0, 0, 0],
         [0, 0, 4, 1_4, 1_0, 0, 2, 0, 0],
         [0, 0, 0, 0, 0, 2, 0, 1, 6],
         [8, 1_1, 0, 0, 0, 0, 1, 0, 7],
         [0, 0, 2, 0, 0, 0, 6, 7, 0],
     ]
     graph.dijkstra(0)
  
  
  
  
  
  
  