




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 MobileViTImageProcessor



class       a_       (     unittest.TestCase     ):





	def __init__(							self      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE=7      ,     SCREAMING_SNAKE_CASE=3      ,     SCREAMING_SNAKE_CASE=18      ,     SCREAMING_SNAKE_CASE=30      ,     SCREAMING_SNAKE_CASE=400      ,     SCREAMING_SNAKE_CASE=True      ,     SCREAMING_SNAKE_CASE=None      ,     SCREAMING_SNAKE_CASE=True      ,     SCREAMING_SNAKE_CASE=None      ,     SCREAMING_SNAKE_CASE=True      ,     )  ->					Tuple:




				"""simple docstring"""



				SCREAMING_SNAKE_CASE_								=						size if size is not None else {'shortest_edge': 20}
				SCREAMING_SNAKE_CASE_								=						crop_size if crop_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_center_crop
				SCREAMING_SNAKE_CASE_								=						crop_size
				SCREAMING_SNAKE_CASE_								=						do_flip_channel_order





	def 						A_(							self      )  ->					int:




				"""simple docstring"""



				return {
				    "do_resize": self.do_resize,
				    "size": self.size,
				    "do_center_crop": self.do_center_crop,
				    "crop_size": self.crop_size,
				    "do_flip_channel_order": self.do_flip_channel_order,
				}




@require_torch
@require_vision
class       a_       (     SCREAMING_SNAKE_CASE__  ,    unittest.TestCase     ):
	A    							= MobileViTImageProcessor if is_vision_available() else None





	def 						A_(							self      )  ->					int:




				"""simple docstring"""



				SCREAMING_SNAKE_CASE_								=						MobileViTImageProcessingTester(self      )





	@property
	def 						A_(							self      )  ->					Union[str, Any]:




				"""simple docstring"""



				return self.image_processor_tester.prepare_image_processor_dict()





	def 						A_(							self      )  ->					Any:




				"""simple docstring"""



				SCREAMING_SNAKE_CASE_								=						self.image_processing_class(**self.image_processor_dict      )
				self.assertTrue(hasattr(SCREAMING_SNAKE_CASE      ,     'do_resize'      )      )
				self.assertTrue(hasattr(SCREAMING_SNAKE_CASE      ,     'size'      )      )
				self.assertTrue(hasattr(SCREAMING_SNAKE_CASE      ,     'do_center_crop'      )      )
				self.assertTrue(hasattr(SCREAMING_SNAKE_CASE      ,     'center_crop'      )      )
				self.assertTrue(hasattr(SCREAMING_SNAKE_CASE      ,     'do_flip_channel_order'      )      )





	def 						A_(							self      )  ->					List[Any]:




				"""simple docstring"""



				SCREAMING_SNAKE_CASE_								=						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}      )

				SCREAMING_SNAKE_CASE_								=						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 						A_(							self      )  ->					Tuple:




				"""simple docstring"""



				pass





	def 						A_(							self      )  ->					Dict:




				"""simple docstring"""



				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=SCREAMING_SNAKE_CASE      )
				for image in image_inputs:
							self.assertIsInstance(SCREAMING_SNAKE_CASE      ,     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.crop_size['height'],
				        self.image_processor_tester.crop_size['width'],
				    )      ,     )

				# Test batched
				SCREAMING_SNAKE_CASE_								=						image_processing(SCREAMING_SNAKE_CASE      ,     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      )  ->					Any:




				"""simple docstring"""



				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=SCREAMING_SNAKE_CASE      ,     numpify=SCREAMING_SNAKE_CASE      )
				for image in image_inputs:
							self.assertIsInstance(SCREAMING_SNAKE_CASE      ,     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.crop_size['height'],
				        self.image_processor_tester.crop_size['width'],
				    )      ,     )

				# Test batched
				SCREAMING_SNAKE_CASE_								=						image_processing(SCREAMING_SNAKE_CASE      ,     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      )  ->					str:




				"""simple docstring"""



				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=SCREAMING_SNAKE_CASE      ,     torchify=SCREAMING_SNAKE_CASE      )
				for image in image_inputs:
							self.assertIsInstance(SCREAMING_SNAKE_CASE      ,     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.crop_size['height'],
				        self.image_processor_tester.crop_size['width'],
				    )      ,     )

				# Test batched
				SCREAMING_SNAKE_CASE_								=						image_processing(SCREAMING_SNAKE_CASE      ,     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'],
				    )      ,     )






from __future__ import annotations

from typing import Any

def lowercase    (  SCREAMING_SNAKE_CASE )			->							None:


			'''simple docstring'''







			create_state_space_tree(SCREAMING_SNAKE_CASE       ,    []       ,    0 )

def lowercase    (  SCREAMING_SNAKE_CASE       ,    SCREAMING_SNAKE_CASE       ,    SCREAMING_SNAKE_CASE )			->							None:


			'''simple docstring'''







			if index == len(SCREAMING_SNAKE_CASE ):
						print(SCREAMING_SNAKE_CASE )
						return

			create_state_space_tree(SCREAMING_SNAKE_CASE       ,    SCREAMING_SNAKE_CASE       ,    index + 1 )
			current_subsequence.append(sequence[index] )
			create_state_space_tree(SCREAMING_SNAKE_CASE       ,    SCREAMING_SNAKE_CASE       ,    index + 1 )
			current_subsequence.pop()


if __name__ == "__main__":
				SCREAMING_SNAKE_CASE__     :     list[Any]		    =       [3, 1, 2, 4]
				generate_all_subsequences(seq)

				seq.clear()
				seq.extend(["A", "B", "C"])
				generate_all_subsequences(seq)
