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_video_inputs


if is_torch_available():
    import torch

if is_vision_available():
    from PIL import Image

    from transformers import VivitImageProcessor



class        lowercase_   (					unittest.TestCase		):



       def __init__(						self				,    lowercase_				,    lowercase_=7				,    lowercase_=3				,    lowercase_=10				,    lowercase_=18				,    lowercase_=30				,    lowercase_=400				,    lowercase_=True				,    lowercase_=None				,    lowercase_=True				,    lowercase_=[0.5, 0.5, 0.5]				,    lowercase_=[0.5, 0.5, 0.5]				,    lowercase_=None				,    ):
             _snake_case						:					Union[str, Any]    =   size if size is not None else {"shortest_edge": 18}
             _snake_case						:					str    =   crop_size if crop_size is not None else {"height": 18, "width": 18}

             _snake_case						:					str    =   parent
             _snake_case						:					int    =   batch_size
             _snake_case						:					int    =   num_channels
             _snake_case						:					str    =   num_frames
             _snake_case						:					List[str]    =   image_size
             _snake_case						:					Optional[Any]    =   min_resolution
             _snake_case						:					Any    =   max_resolution
             _snake_case						:					Optional[int]    =   do_resize
             _snake_case						:					Optional[int]    =   size
             _snake_case						:					Optional[int]    =   do_normalize
             _snake_case						:					Union[str, Any]    =   image_mean
             _snake_case						:					Optional[int]    =   image_std
             _snake_case						:					str    =   crop_size



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




@require_torch
@require_vision
class        lowercase_   (					SCREAMING_SNAKE_CASE__						,			unittest.TestCase		):
       _lowerCamelCase						=		VivitImageProcessor if is_vision_available() else None



       def 	UpperCamelCase	(						self    ):
             _snake_case						:					List[Any]    =   VivitImageProcessingTester(self    )



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



       def 	UpperCamelCase	(						self    ):
             _snake_case						:					Tuple    =   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_				,    "do_center_crop"    )    )
             self.assertTrue(hasattr(a_				,    "size"    )    )



       def 	UpperCamelCase	(						self    ):
             _snake_case						:					Any    =   self.image_processing_class.from_dict(self.image_processor_dict    )
             self.assertEqual(image_processor.size				,    {"shortest_edge": 18}    )
             self.assertEqual(image_processor.crop_size				,    {"height": 18, "width": 18}    )

             _snake_case						:					int    =   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 	UpperCamelCase	(						self    ):
             _snake_case						:					Dict    =   self.image_processing_class(**self.image_processor_dict    )
             # create random PIL videos
             _snake_case						:					Dict    =   prepare_video_inputs(self.image_processor_tester				,    equal_resolution=a_    )
             for video in video_inputs:
                   self.assertIsInstance(a_				,    a_    )
                   self.assertIsInstance(video[0]				,    Image.Image    )

             # Test not batched input
             _snake_case						:					str    =   image_processing(video_inputs[0]				,    return_tensors="pt"    ).pixel_values
             self.assertEqual(
                 encoded_videos.shape				,    (
                     1,
                     self.image_processor_tester.num_frames,
                     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[str]    =   image_processing(a_				,    return_tensors="pt"    ).pixel_values
             self.assertEqual(
                 encoded_videos.shape				,    (
                     self.image_processor_tester.batch_size,
                     self.image_processor_tester.num_frames,
                     self.image_processor_tester.num_channels,
                     self.image_processor_tester.crop_size["height"],
                     self.image_processor_tester.crop_size["width"],
                 )				,    )



       def 	UpperCamelCase	(						self    ):
             _snake_case						:					Optional[int]    =   self.image_processing_class(**self.image_processor_dict    )
             # create random numpy tensors
             _snake_case						:					Optional[int]    =   prepare_video_inputs(self.image_processor_tester				,    equal_resolution=a_				,    numpify=a_    )
             for video in video_inputs:
                   self.assertIsInstance(a_				,    a_    )
                   self.assertIsInstance(video[0]				,    np.ndarray    )

             # Test not batched input
             _snake_case						:					Optional[Any]    =   image_processing(video_inputs[0]				,    return_tensors="pt"    ).pixel_values
             self.assertEqual(
                 encoded_videos.shape				,    (
                     1,
                     self.image_processor_tester.num_frames,
                     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(a_				,    return_tensors="pt"    ).pixel_values
             self.assertEqual(
                 encoded_videos.shape				,    (
                     self.image_processor_tester.batch_size,
                     self.image_processor_tester.num_frames,
                     self.image_processor_tester.num_channels,
                     self.image_processor_tester.crop_size["height"],
                     self.image_processor_tester.crop_size["width"],
                 )				,    )



       def 	UpperCamelCase	(						self    ):
             _snake_case						:					List[str]    =   self.image_processing_class(**self.image_processor_dict    )
             # create random PyTorch tensors
             _snake_case						:					Optional[Any]    =   prepare_video_inputs(self.image_processor_tester				,    equal_resolution=a_				,    torchify=a_    )
             for video in video_inputs:
                   self.assertIsInstance(a_				,    a_    )
                   self.assertIsInstance(video[0]				,    torch.Tensor    )

             # Test not batched input
             _snake_case						:					List[str]    =   image_processing(video_inputs[0]				,    return_tensors="pt"    ).pixel_values
             self.assertEqual(
                 encoded_videos.shape				,    (
                     1,
                     self.image_processor_tester.num_frames,
                     self.image_processor_tester.num_channels,
                     self.image_processor_tester.crop_size["height"],
                     self.image_processor_tester.crop_size["width"],
                 )				,    )

             # Test batched
             _snake_case						:					int    =   image_processing(a_				,    return_tensors="pt"    ).pixel_values
             self.assertEqual(
                 encoded_videos.shape				,    (
                     self.image_processor_tester.batch_size,
                     self.image_processor_tester.num_frames,
                     self.image_processor_tester.num_channels,
                     self.image_processor_tester.crop_size["height"],
                     self.image_processor_tester.crop_size["width"],
                 )				,    )
from __future__ import annotations
def  snake_case						(__lowercase ,      __lowercase						)	->	float:

						'''simple docstring'''



						_snake_case						:					Any    =   sorted(numsa + numsa						)
						_snake_case    ,_snake_case						:					Any    =   divmod(len(__lowercase						) ,      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						:   Union[str, Any]         =			[float(x) for x in input('Enter the elements of first array: ').split()]
				__SCREAMING_SNAKE_CASE						:   List[Any]         =			[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)}''')