

import unittest

import numpy as np

from transformers.testing_utils import is_flaky, 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 DonutImageProcessor



class 					_a		(unittest.TestCase       ):


					'''simple docstring'''






					def __init__(				self					, A__					, A__=7					, A__=3					, A__=18					, A__=30					, A__=400					, A__=True					, A__=None					, A__=True					, A__=False					, A__=True					, A__=True					, A__=[0.5, 0.5, 0.5]					, A__=[0.5, 0.5, 0.5]					, ):
						A__							:					int       =	parent
						A__							:					Optional[Any]       =	batch_size
						A__							:					Tuple       =	num_channels
						A__							:					Dict       =	image_size
						A__							:					str       =	min_resolution
						A__							:					List[str]       =	max_resolution
						A__							:					Tuple       =	do_resize
						A__							:					Tuple       =	size if size is not None else {"""height""": 18, """width""": 20}
						A__							:					Optional[Any]       =	do_thumbnail
						A__							:					int       =	do_align_axis
						A__							:					List[str]       =	do_pad
						A__							:					List[str]       =	do_normalize
						A__							:					Any       =	image_mean
						A__							:					List[Any]       =	image_std






					def 						__A    (				self    ):
						return {
						    "do_resize": self.do_resize,
						    "size": self.size,
						    "do_thumbnail": self.do_thumbnail,
						    "do_align_long_axis": self.do_align_axis,
						    "do_pad": self.do_pad,
						    "do_normalize": self.do_normalize,
						    "image_mean": self.image_mean,
						    "image_std": self.image_std,
						}



@require_torch
@require_vision
class 					_a		(__magic_name__	,     unittest.TestCase       ):


					'''simple docstring'''






					UpperCAmelCase__:     Tuple													= DonutImageProcessor if is_vision_available() else None






					def 						__A    (				self    ):
						A__							:					Optional[int]       =	DonutImageProcessingTester(self    )






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






					def 						__A    (				self    ):
						A__							:					List[Any]       =	self.image_processing_class(**self.image_processor_dict    )
						self.assertTrue(hasattr(A__					, """do_resize"""    )    )
						self.assertTrue(hasattr(A__					, """size"""    )    )
						self.assertTrue(hasattr(A__					, """do_thumbnail"""    )    )
						self.assertTrue(hasattr(A__					, """do_align_long_axis"""    )    )
						self.assertTrue(hasattr(A__					, """do_pad"""    )    )
						self.assertTrue(hasattr(A__					, """do_normalize"""    )    )
						self.assertTrue(hasattr(A__					, """image_mean"""    )    )
						self.assertTrue(hasattr(A__					, """image_std"""    )    )






					def 						__A    (				self    ):
						A__							:					str       =	self.image_processing_class.from_dict(self.image_processor_dict    )
						self.assertEqual(image_processor.size					, {"""height""": 18, """width""": 20}    )

						A__							:					int       =	self.image_processing_class.from_dict(self.image_processor_dict					, size=42    )
						self.assertEqual(image_processor.size					, {"""height""": 42, """width""": 42}    )

						# Previous config had dimensions in (width, height) order
						A__							:					Tuple       =	self.image_processing_class.from_dict(self.image_processor_dict					, size=(42, 84)    )
						self.assertEqual(image_processor.size					, {"""height""": 84, """width""": 42}    )






					def 						__A    (				self    ):
						pass






					@is_flaky()
					def 						__A    (				self    ):
						# Initialize image_processing
						A__							:					int       =	self.image_processing_class(**self.image_processor_dict    )
						# create random PIL images
						A__							:					Union[str, Any]       =	prepare_image_inputs(self.image_processor_tester					, equal_resolution=A__    )
						for image in image_inputs:
							self.assertIsInstance(A__					, Image.Image    )

						# Test not batched input
						A__							:					Optional[int]       =	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.size["""height"""],
						        self.image_processor_tester.size["""width"""],
						    )					, )

						# Test batched
						A__							:					Union[str, Any]       =	image_processing(A__					, 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.size["""height"""],
						        self.image_processor_tester.size["""width"""],
						    )					, )






					@is_flaky()
					def 						__A    (				self    ):
						# Initialize image_processing
						A__							:					Union[str, Any]       =	self.image_processing_class(**self.image_processor_dict    )
						# create random numpy tensors
						A__							:					List[str]       =	prepare_image_inputs(self.image_processor_tester					, equal_resolution=A__					, numpify=A__    )
						for image in image_inputs:
							self.assertIsInstance(A__					, np.ndarray    )

						# Test not batched input
						A__							:					Union[str, Any]       =	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.size["""height"""],
						        self.image_processor_tester.size["""width"""],
						    )					, )

						# Test batched
						A__							:					Optional[int]       =	image_processing(A__					, 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.size["""height"""],
						        self.image_processor_tester.size["""width"""],
						    )					, )






					@is_flaky()
					def 						__A    (				self    ):
						# Initialize image_processing
						A__							:					Any       =	self.image_processing_class(**self.image_processor_dict    )
						# create random PyTorch tensors
						A__							:					List[str]       =	prepare_image_inputs(self.image_processor_tester					, equal_resolution=A__					, torchify=A__    )
						for image in image_inputs:
							self.assertIsInstance(A__					, torch.Tensor    )

						# Test not batched input
						A__							:					Optional[Any]       =	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.size["""height"""],
						        self.image_processor_tester.size["""width"""],
						    )					, )

						# Test batched
						A__							:					List[Any]       =	image_processing(A__					, 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.size["""height"""],
						        self.image_processor_tester.size["""width"""],
						    )					, )






def 		UpperCamelCase      (lowercase_:				int					,   lowercase_:				int      )  ->   int:
	while second != 0:
		A__							:					int       =	first & second
		first ^= second
		A__							:					int       =	c << 1
	return first


if __name__ == "__main__":
	import doctest

	doctest.testmod()

	A_ :				Optional[Any]						 =    int(input('Enter the first number: ').strip())
	A_ :				List[str]						 =    int(input('Enter the second number: ').strip())
	print(f'''{add(first, second) = }''')



