
'''simple docstring'''



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 EfficientNetImageProcessor

class 				_a			(unittest.TestCase):





       """simple docstring"""




       def __init__(							self    ,							A__    ,							A__=13    ,							A__=3    ,							A__=18    ,							A__=30    ,							A__=4_00    ,							A__=True    ,							A__=None    ,							A__=True    ,							A__=[0.5, 0.5, 0.5]    ,							A__=[0.5, 0.5, 0.5]    ,							)      ->     List[str]:
          _SCREAMING_SNAKE_CASE       	=			size if size is not None else {"""height""": 18, """width""": 18}
          _SCREAMING_SNAKE_CASE       	=			parent
          _SCREAMING_SNAKE_CASE       	=			batch_size
          _SCREAMING_SNAKE_CASE       	=			num_channels
          _SCREAMING_SNAKE_CASE       	=			image_size
          _SCREAMING_SNAKE_CASE       	=			min_resolution
          _SCREAMING_SNAKE_CASE       	=			max_resolution
          _SCREAMING_SNAKE_CASE       	=			do_resize
          _SCREAMING_SNAKE_CASE       	=			size
          _SCREAMING_SNAKE_CASE       	=			do_normalize
          _SCREAMING_SNAKE_CASE       	=			image_mean
          _SCREAMING_SNAKE_CASE       	=			image_std






       def     UpperCamelCase			(							self )      ->     str:
          return {
              "image_mean": self.image_mean,
              "image_std": self.image_std,
              "do_normalize": self.do_normalize,
              "do_resize": self.do_resize,
              "size": self.size,
          }






@require_torch
@require_vision
class 				_a			(_lowerCamelCase					,   unittest.TestCase):





       """simple docstring"""




       SCREAMING_SNAKE_CASE =					EfficientNetImageProcessor if is_vision_available() else None






       def     UpperCamelCase			(							self )      ->     str:
          _SCREAMING_SNAKE_CASE       	=			EfficientNetImageProcessorTester(self )






       @property
       def     UpperCamelCase			(							self )      ->     Dict:
          return self.image_processor_tester.prepare_image_processor_dict()






       def     UpperCamelCase			(							self )      ->     Union[str, Any]:
          _SCREAMING_SNAKE_CASE       	=			self.image_processing_class(**self.image_processor_dict )
          self.assertTrue(hasattr(A__    ,							"""image_mean""" ) )
          self.assertTrue(hasattr(A__    ,							"""image_std""" ) )
          self.assertTrue(hasattr(A__    ,							"""do_normalize""" ) )
          self.assertTrue(hasattr(A__    ,							"""do_resize""" ) )
          self.assertTrue(hasattr(A__    ,							"""size""" ) )






       def     UpperCamelCase			(							self )      ->     Any:
          _SCREAMING_SNAKE_CASE       	=			self.image_processing_class.from_dict(self.image_processor_dict )
          self.assertEqual(image_processor.size    ,							{"""height""": 18, """width""": 18} )

          _SCREAMING_SNAKE_CASE       	=			self.image_processing_class.from_dict(self.image_processor_dict    ,							size=42 )
          self.assertEqual(image_processor.size    ,							{"""height""": 42, """width""": 42} )






       def     UpperCamelCase			(							self )      ->     int:
          # Initialize image_processing
          _SCREAMING_SNAKE_CASE       	=			self.image_processing_class(**self.image_processor_dict )
          # create random PIL images
          _SCREAMING_SNAKE_CASE       	=			prepare_image_inputs(self.image_processor_tester    ,							equal_resolution=A__ )
          for image in image_inputs:
             self.assertIsInstance(A__    ,							Image.Image )

          # Test not batched input
          _SCREAMING_SNAKE_CASE       	=			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.size["""height"""],
                  self.image_processor_tester.size["""width"""],
              )    ,							)

          # Test batched
          _SCREAMING_SNAKE_CASE       	=			image_processing(A__    ,							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.size["""height"""],
                  self.image_processor_tester.size["""width"""],
              )    ,							)






       def     UpperCamelCase			(							self )      ->     Dict:
          # Initialize image_processing
          _SCREAMING_SNAKE_CASE       	=			self.image_processing_class(**self.image_processor_dict )
          # create random numpy tensors
          _SCREAMING_SNAKE_CASE       	=			prepare_image_inputs(self.image_processor_tester    ,							equal_resolution=A__    ,							numpify=A__ )
          for image in image_inputs:
             self.assertIsInstance(A__    ,							np.ndarray )

          # Test not batched input
          _SCREAMING_SNAKE_CASE       	=			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.size["""height"""],
                  self.image_processor_tester.size["""width"""],
              )    ,							)

          # Test batched
          _SCREAMING_SNAKE_CASE       	=			image_processing(A__    ,							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.size["""height"""],
                  self.image_processor_tester.size["""width"""],
              )    ,							)






       def     UpperCamelCase			(							self )      ->     Union[str, Any]:
          # Initialize image_processing
          _SCREAMING_SNAKE_CASE       	=			self.image_processing_class(**self.image_processor_dict )
          # create random PyTorch tensors
          _SCREAMING_SNAKE_CASE       	=			prepare_image_inputs(self.image_processor_tester    ,							equal_resolution=A__    ,							torchify=A__ )
          for image in image_inputs:
             self.assertIsInstance(A__    ,							torch.Tensor )

          # Test not batched input
          _SCREAMING_SNAKE_CASE       	=			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.size["""height"""],
                  self.image_processor_tester.size["""width"""],
              )    ,							)

          # Test batched
          _SCREAMING_SNAKE_CASE       	=			image_processing(A__    ,							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.size["""height"""],
                  self.image_processor_tester.size["""width"""],
              )    ,							)








'''simple docstring'''



def 				lowerCAmelCase_		(			SCREAMING_SNAKE_CASE_      , SCREAMING_SNAKE_CASE_  )       ->       Optional[int]:




   """simple docstring"""
   print("""\nVertex Distance"""  )
   for i in range(SCREAMING_SNAKE_CASE_  ):
      if dist[i] != float("""inf"""  ):
         print(SCREAMING_SNAKE_CASE_      , """\t"""      , int(dist[i]  )      , end="""\t"""  )
      else:
         print(SCREAMING_SNAKE_CASE_      , """\t"""      , """INF"""      , end="""\t"""  )
      print()
def 				lowerCAmelCase_		(			SCREAMING_SNAKE_CASE_      , SCREAMING_SNAKE_CASE_      , SCREAMING_SNAKE_CASE_  )       ->       Optional[Any]:




   """simple docstring"""
   _SCREAMING_SNAKE_CASE       	=			float("""inf"""  )
   _SCREAMING_SNAKE_CASE       	=			-1
   for i in range(SCREAMING_SNAKE_CASE_  ):
      if (not vset[i]) and mdist[i] < min_val:
         _SCREAMING_SNAKE_CASE       	=			i
         _SCREAMING_SNAKE_CASE       	=			mdist[i]
   return min_ind
def 				lowerCAmelCase_		(			SCREAMING_SNAKE_CASE_      , SCREAMING_SNAKE_CASE_      , SCREAMING_SNAKE_CASE_  )       ->       int:




   """simple docstring"""
   _SCREAMING_SNAKE_CASE       	=			[float("""inf"""  ) for _ in range(SCREAMING_SNAKE_CASE_  )]
   _SCREAMING_SNAKE_CASE       	=			[False for _ in range(SCREAMING_SNAKE_CASE_  )]
   _SCREAMING_SNAKE_CASE       	=			0.0

   for _ in range(v - 1  ):
      _SCREAMING_SNAKE_CASE       	=			min_dist(SCREAMING_SNAKE_CASE_      , SCREAMING_SNAKE_CASE_      , SCREAMING_SNAKE_CASE_  )
      _SCREAMING_SNAKE_CASE       	=			True

      for i in range(SCREAMING_SNAKE_CASE_  ):
         if (
             (not vset[i])
             and graph[u][i] != float("""inf"""  )
             and mdist[u] + graph[u][i] < mdist[i]
         ):
            _SCREAMING_SNAKE_CASE       	=			mdist[u] + graph[u][i]

   print_dist(SCREAMING_SNAKE_CASE_      , SCREAMING_SNAKE_CASE_  )


if __name__ == "__main__":
     UpperCamelCase__ :						int    							=					int(input("Enter number of vertices: ").strip())
     UpperCamelCase__ :						Tuple    							=					int(input("Enter number of edges: ").strip())

     UpperCamelCase__ :						Optional[Any]    							=					[[float("inf") for i in range(V)] for j in range(V)]

     for i in range(V):
          UpperCamelCase__ :						int    							=					0.0

     for i in range(E):
          print("\nEdge ", i + 1)
          UpperCamelCase__ :						Union[str, Any]    							=					int(input("Enter source:").strip())
          UpperCamelCase__ :						Tuple    							=					int(input("Enter destination:").strip())
          UpperCamelCase__ :						Any    							=					float(input("Enter weight:").strip())
          UpperCamelCase__ :						List[Any]    							=					weight

     UpperCamelCase__ :						Optional[Any]    							=					int(input("\nEnter shortest path source:").strip())
     dijkstra(graph, V, gsrc)






