


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





class        lowercase__    (		unittest.TestCase   ):





							'''simple docstring'''


							def __init__(       self       ,   __snake_case       ,   __snake_case=13       ,   __snake_case=3       ,   __snake_case=224       ,   __snake_case=30       ,   __snake_case=400       ,   __snake_case=True       ,   __snake_case=None       ,   __snake_case=True       ,   __snake_case=[0.5, 0.5, 0.5]       ,   __snake_case=[0.5, 0.5, 0.5]       ,   ):
											_SCREAMING_SNAKE_CASE					:			Dict							= size if size is not None else {"""height""": 18, """width""": 18}
											_SCREAMING_SNAKE_CASE					:			Optional[Any]							= parent
											_SCREAMING_SNAKE_CASE					:			Tuple							= batch_size
											_SCREAMING_SNAKE_CASE					:			List[str]							= num_channels
											_SCREAMING_SNAKE_CASE					:			List[str]							= image_size
											_SCREAMING_SNAKE_CASE					:			Dict							= min_resolution
											_SCREAMING_SNAKE_CASE					:			str							= max_resolution
											_SCREAMING_SNAKE_CASE					:			Dict							= do_resize
											_SCREAMING_SNAKE_CASE					:			Tuple							= size
											_SCREAMING_SNAKE_CASE					:			Optional[Any]							= do_normalize
											_SCREAMING_SNAKE_CASE					:			str							= image_mean
											_SCREAMING_SNAKE_CASE					:			Tuple							= image_std






							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,
											}





@require_torch
@require_vision
class        lowercase__    (		_snake_case	,	unittest.TestCase   ):





							'''simple docstring'''


							A_				: Any       =    ViTImageProcessor if is_vision_available() else None






							def UpperCAmelCase_      (       self    ):
											_SCREAMING_SNAKE_CASE					:			Tuple							= EfficientFormerImageProcessorTester(self    )






							@property
							def UpperCAmelCase_      (       self    ):
											return self.image_proc_tester.prepare_image_processor_dict()






							def UpperCAmelCase_      (       self    ):
											_SCREAMING_SNAKE_CASE					:			int							= self.image_processing_class(**self.image_processor_dict    )
											self.assertTrue(hasattr(__snake_case       ,   """image_mean"""    )    )
											self.assertTrue(hasattr(__snake_case       ,   """image_std"""    )    )
											self.assertTrue(hasattr(__snake_case       ,   """do_normalize"""    )    )
											self.assertTrue(hasattr(__snake_case       ,   """do_resize"""    )    )
											self.assertTrue(hasattr(__snake_case       ,   """size"""    )    )






							def UpperCAmelCase_      (       self    ):
											pass






							def UpperCAmelCase_      (       self    ):
											# Initialize image_processor
											_SCREAMING_SNAKE_CASE					:			Dict							= self.image_processing_class(**self.image_processor_dict    )
											# create random PIL images
											_SCREAMING_SNAKE_CASE					:			Tuple							= prepare_image_inputs(self.image_proc_tester       ,   equal_resolution=__snake_case    )
											for image in image_inputs:
															self.assertIsInstance(__snake_case       ,   Image.Image    )

											# Test not batched input
											_SCREAMING_SNAKE_CASE					:			Optional[Any]							= image_processor(image_inputs[0]       ,   return_tensors="""pt"""    ).pixel_values
											self.assertEqual(
											    encoded_images.shape       ,   (
											        1,
											        self.image_proc_tester.num_channels,
											        self.image_proc_tester.size["""height"""],
											        self.image_proc_tester.size["""width"""],
											    )       ,   )

											# Test batched
											_SCREAMING_SNAKE_CASE					:			List[str]							= image_processor(__snake_case       ,   return_tensors="""pt"""    ).pixel_values
											self.assertEqual(
											    encoded_images.shape       ,   (
											        self.image_proc_tester.batch_size,
											        self.image_proc_tester.num_channels,
											        self.image_proc_tester.size["""height"""],
											        self.image_proc_tester.size["""width"""],
											    )       ,   )






							def UpperCAmelCase_      (       self    ):
											# Initialize image_processor
											_SCREAMING_SNAKE_CASE					:			List[str]							= self.image_processing_class(**self.image_processor_dict    )
											# create random numpy tensors
											_SCREAMING_SNAKE_CASE					:			Dict							= prepare_image_inputs(self.image_proc_tester       ,   equal_resolution=__snake_case       ,   numpify=__snake_case    )
											for image in image_inputs:
															self.assertIsInstance(__snake_case       ,   np.ndarray    )

											# Test not batched input
											_SCREAMING_SNAKE_CASE					:			List[Any]							= image_processor(image_inputs[0]       ,   return_tensors="""pt"""    ).pixel_values
											self.assertEqual(
											    encoded_images.shape       ,   (
											        1,
											        self.image_proc_tester.num_channels,
											        self.image_proc_tester.size["""height"""],
											        self.image_proc_tester.size["""width"""],
											    )       ,   )

											# Test batched
											_SCREAMING_SNAKE_CASE					:			Any							= image_processor(__snake_case       ,   return_tensors="""pt"""    ).pixel_values
											self.assertEqual(
											    encoded_images.shape       ,   (
											        self.image_proc_tester.batch_size,
											        self.image_proc_tester.num_channels,
											        self.image_proc_tester.size["""height"""],
											        self.image_proc_tester.size["""width"""],
											    )       ,   )






							def UpperCAmelCase_      (       self    ):
											# Initialize image_processor
											_SCREAMING_SNAKE_CASE					:			Dict							= self.image_processing_class(**self.image_processor_dict    )
											# create random PyTorch tensors
											_SCREAMING_SNAKE_CASE					:			Tuple							= prepare_image_inputs(self.image_proc_tester       ,   equal_resolution=__snake_case       ,   torchify=__snake_case    )
											for image in image_inputs:
															self.assertIsInstance(__snake_case       ,   torch.Tensor    )

											# Test not batched input
											_SCREAMING_SNAKE_CASE					:			Union[str, Any]							= image_processor(image_inputs[0]       ,   return_tensors="""pt"""    ).pixel_values
											self.assertEqual(
											    encoded_images.shape       ,   (
											        1,
											        self.image_proc_tester.num_channels,
											        self.image_proc_tester.size["""height"""],
											        self.image_proc_tester.size["""width"""],
											    )       ,   )

											# Test batched
											_SCREAMING_SNAKE_CASE					:			Dict							= image_processor(__snake_case       ,   return_tensors="""pt"""    ).pixel_values
											self.assertEqual(
											    encoded_images.shape       ,   (
											        self.image_proc_tester.batch_size,
											        self.image_proc_tester.num_channels,
											        self.image_proc_tester.size["""height"""],
											        self.image_proc_tester.size["""width"""],
											    )       ,   )








'''simple docstring'''


from __future__ import annotations







def      snake_case_  (    SCREAMING_SNAKE_CASE__				, SCREAMING_SNAKE_CASE__	):







				"""simple docstring"""





				if len(SCREAMING_SNAKE_CASE__	) <= 1 or n <= 1:
								return

				insert_next(SCREAMING_SNAKE_CASE__				, n - 1	)
				rec_insertion_sort(SCREAMING_SNAKE_CASE__				, n - 1	)







def      snake_case_  (    SCREAMING_SNAKE_CASE__				, SCREAMING_SNAKE_CASE__	):







				"""simple docstring"""





				if index >= len(SCREAMING_SNAKE_CASE__	) or collection[index - 1] <= collection[index]:
								return

				# Swaps adjacent elements since they are not in ascending order
				_SCREAMING_SNAKE_CASE						,			_SCREAMING_SNAKE_CASE					:			List[Any]							= (
				    collection[index],
				    collection[index - 1],
				)

				insert_next(SCREAMING_SNAKE_CASE__				, index + 1	)


if __name__ == "__main__":
				UpperCAmelCase_						:  List[str]				  =						input('Enter integers separated by spaces: ')
				UpperCAmelCase_						:  list[int]				  =						[int(num) for num in numbers.split()]
				rec_insertion_sort(number_list, len(number_list))
				print(number_list)




