





'''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 MobileNetVaImageProcessor

class    lowerCAmelCase_		(		unittest.TestCase		):




 def __init__(	self			,     _lowerCAmelCase			,     _lowerCAmelCase=7			,     _lowerCAmelCase=3			,     _lowerCAmelCase=18			,     _lowerCAmelCase=30			,     _lowerCAmelCase=400			,     _lowerCAmelCase=True			,     _lowerCAmelCase=None			,     _lowerCAmelCase=True			,     _lowerCAmelCase=None			,     )    ->							Optional[Any]:
     _lowerCAmelCase				=      size if size is not None else {"shortest_edge": 20}
     _lowerCAmelCase				=      crop_size if crop_size is not None else {"height": 18, "width": 18}
     _lowerCAmelCase				=      parent
     _lowerCAmelCase				=      batch_size
     _lowerCAmelCase				=      num_channels
     _lowerCAmelCase				=      image_size
     _lowerCAmelCase				=      min_resolution
     _lowerCAmelCase				=      max_resolution
     _lowerCAmelCase				=      do_resize
     _lowerCAmelCase				=      size
     _lowerCAmelCase				=      do_center_crop
     _lowerCAmelCase				=      crop_size





 def 							_snake_case   (	self		)    ->							str:
     return {
         "do_resize": self.do_resize,
         "size": self.size,
         "do_center_crop": self.do_center_crop,
         "crop_size": self.crop_size,
     }







@require_torch
@require_vision
class    lowerCAmelCase_		(		__magic_name__						,unittest.TestCase		):
 __lowerCamelCase						:							List[Any]         =					MobileNetVaImageProcessor if is_vision_available() else None




 def 							_snake_case   (	self		)    ->							Optional[Any]:
     _lowerCAmelCase				=      MobileNetVaImageProcessingTester(self		)




 @property
 def 							_snake_case   (	self		)    ->							Tuple:
     return self.image_processor_tester.prepare_image_processor_dict()




 def 							_snake_case   (	self		)    ->							Union[str, Any]:
     _lowerCAmelCase				=      self.image_processing_class(**self.image_processor_dict		)
     self.assertTrue(hasattr(_lowerCAmelCase			,     "do_resize"		)		)
     self.assertTrue(hasattr(_lowerCAmelCase			,     "size"		)		)
     self.assertTrue(hasattr(_lowerCAmelCase			,     "do_center_crop"		)		)
     self.assertTrue(hasattr(_lowerCAmelCase			,     "crop_size"		)		)




 def 							_snake_case   (	self		)    ->							Union[str, Any]:
     _lowerCAmelCase				=      self.image_processing_class.from_dict(self.image_processor_dict		)
     self.assertEqual(image_processor.size			,     {"shortest_edge": 20}		)
     self.assertEqual(image_processor.crop_size			,     {"height": 18, "width": 18}		)

     _lowerCAmelCase				=      self.image_processing_class.from_dict(self.image_processor_dict			,     size=42			,     crop_size=84		)
     self.assertEqual(image_processor.size			,     {"shortest_edge": 42}		)
     self.assertEqual(image_processor.crop_size			,     {"height": 84, "width": 84}		)




 def 							_snake_case   (	self		)    ->							int:
     pass




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

     # Test not batched input
     _lowerCAmelCase				=      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
     _lowerCAmelCase				=      image_processing(_lowerCAmelCase			,     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 							_snake_case   (	self		)    ->							Dict:
     # Initialize image_processing
     _lowerCAmelCase				=      self.image_processing_class(**self.image_processor_dict		)
     # create random numpy tensors
     _lowerCAmelCase				=      prepare_image_inputs(self.image_processor_tester			,     equal_resolution=_lowerCAmelCase			,     numpify=_lowerCAmelCase		)
     for image in image_inputs:
         self.assertIsInstance(_lowerCAmelCase			,     np.ndarray		)

     # Test not batched input
     _lowerCAmelCase				=      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
     _lowerCAmelCase				=      image_processing(_lowerCAmelCase			,     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 							_snake_case   (	self		)    ->							Optional[int]:
     # Initialize image_processing
     _lowerCAmelCase				=      self.image_processing_class(**self.image_processor_dict		)
     # create random PyTorch tensors
     _lowerCAmelCase				=      prepare_image_inputs(self.image_processor_tester			,     equal_resolution=_lowerCAmelCase			,     torchify=_lowerCAmelCase		)
     for image in image_inputs:
         self.assertIsInstance(_lowerCAmelCase			,     torch.Tensor		)

     # Test not batched input
     _lowerCAmelCase				=      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
     _lowerCAmelCase				=      image_processing(_lowerCAmelCase			,     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"],
         )			,     )









'''simple docstring'''


from __future__ import annotations


def 	__a(SCREAMING_SNAKE_CASE_  :					list[float]		,       SCREAMING_SNAKE_CASE_  :					list[float]    ):



    '''simple docstring'''





    _lowerCAmelCase				=      sorted(numsa + numsa    )
    _lowerCAmelCase			,			_lowerCAmelCase				=      divmod(len(SCREAMING_SNAKE_CASE_    )		,       2    )
    if mod == 1:
        return all_numbers[div]
    else:
        return (all_numbers[div] + all_numbers[div - 1]) / 2


if __name__ == "__main__":
       import doctest

       doctest.testmod()
       _SCREAMING_SNAKE_CASE	 =							[float(x) for x in input("Enter the elements of first array: ").split()]
       _SCREAMING_SNAKE_CASE	 =							[float(x) for x in input("Enter the elements of second array: ").split()]
       print(f'''The median of two arrays is: {median_of_two_arrays(array_a, array_a)}''')


