


"""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        __A       (unittest.TestCase):





							'''simple docstring'''

							def __init__(			self							: List[Any]						,    UpperCAmelCase_							: Optional[Any]						,    UpperCAmelCase_							: Tuple=13						,    UpperCAmelCase_							: List[str]=3						,    UpperCAmelCase_							: List[Any]=224						,    UpperCAmelCase_							: Tuple=30						,    UpperCAmelCase_							: Union[str, Any]=400						,    UpperCAmelCase_							: List[str]=True						,    UpperCAmelCase_							: Optional[Any]=None						,    UpperCAmelCase_							: Tuple=True						,    UpperCAmelCase_							: Any=[0.5, 0.5, 0.5]						,    UpperCAmelCase_							: Optional[int]=[0.5, 0.5, 0.5]						,    )   ->Union[str, Any]:



														"""simple docstring"""



														snake_case_          =						size if size is not None else {'''height''': 18, '''width''': 18}
														snake_case_          =						parent
														snake_case_          =						batch_size
														snake_case_          =						num_channels
														snake_case_          =						image_size
														snake_case_          =						min_resolution
														snake_case_          =						max_resolution
														snake_case_          =						do_resize
														snake_case_          =						size
														snake_case_          =						do_normalize
														snake_case_          =						image_mean
														snake_case_          =						image_std



							def 						lowerCAmelCase    (			self							: Tuple    )   ->Optional[int]:



														"""simple docstring"""



														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       (a__  ,						unittest.TestCase):





							'''simple docstring'''

							__lowercase:						List[str]							 =      ViTImageProcessor if is_vision_available() else None



							def 						lowerCAmelCase    (			self							: Union[str, Any]    )   ->Union[str, Any]:



														"""simple docstring"""



														snake_case_          =						EfficientFormerImageProcessorTester(self    )



							@property
							def 						lowerCAmelCase    (			self							: Any    )   ->Any:



														"""simple docstring"""



														return self.image_proc_tester.prepare_image_processor_dict()



							def 						lowerCAmelCase    (			self							: int    )   ->str:



														"""simple docstring"""



														snake_case_          =						self.image_processing_class(**self.image_processor_dict    )
														self.assertTrue(hasattr(_lowerCamelCase						,    """image_mean"""    )    )
														self.assertTrue(hasattr(_lowerCamelCase						,    """image_std"""    )    )
														self.assertTrue(hasattr(_lowerCamelCase						,    """do_normalize"""    )    )
														self.assertTrue(hasattr(_lowerCamelCase						,    """do_resize"""    )    )
														self.assertTrue(hasattr(_lowerCamelCase						,    """size"""    )    )



							def 						lowerCAmelCase    (			self							: Tuple    )   ->Any:



														"""simple docstring"""



														pass



							def 						lowerCAmelCase    (			self							: Union[str, Any]    )   ->int:



														"""simple docstring"""



														snake_case_          =						self.image_processing_class(**self.image_processor_dict    )
														# create random PIL images
														snake_case_          =						prepare_image_inputs(self.image_proc_tester						,    equal_resolution=_lowerCamelCase    )
														for image in image_inputs:
																					self.assertIsInstance(_lowerCamelCase						,    Image.Image    )

														# Test not batched input
														snake_case_          =						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
														snake_case_          =						image_processor(_lowerCamelCase						,    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 						lowerCAmelCase    (			self							: Any    )   ->str:



														"""simple docstring"""



														snake_case_          =						self.image_processing_class(**self.image_processor_dict    )
														# create random numpy tensors
														snake_case_          =						prepare_image_inputs(self.image_proc_tester						,    equal_resolution=_lowerCamelCase						,    numpify=_lowerCamelCase    )
														for image in image_inputs:
																					self.assertIsInstance(_lowerCamelCase						,    np.ndarray    )

														# Test not batched input
														snake_case_          =						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
														snake_case_          =						image_processor(_lowerCamelCase						,    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 						lowerCAmelCase    (			self							: Optional[int]    )   ->str:



														"""simple docstring"""



														snake_case_          =						self.image_processing_class(**self.image_processor_dict    )
														# create random PyTorch tensors
														snake_case_          =						prepare_image_inputs(self.image_proc_tester						,    equal_resolution=_lowerCamelCase						,    torchify=_lowerCamelCase    )
														for image in image_inputs:
																					self.assertIsInstance(_lowerCamelCase						,    torch.Tensor    )

														# Test not batched input
														snake_case_          =						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
														snake_case_          =						image_processor(_lowerCamelCase						,    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"""
def   _a			( _SCREAMING_SNAKE_CASE			,	_SCREAMING_SNAKE_CASE			)      ->			str:
							return "\n".join(
							    f"""{number} * {i} = {number * i}""" for i in range(1			,	number_of_terms + 1			)			)


if __name__ == "__main__":
				print(multiplication_table(number=5, number_of_terms=10))



