




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


if is_torch_available():
					import torch

if is_vision_available():
					from PIL import Image

					from transformers import BlipImageProcessor
class      a__       (   unittest.TestCase ):






						def __init__(  self						,     _A						,     _A=7						,     _A=3						,     _A=1_8						,     _A=3_0						,     _A=4_0_0						,     _A=True						,     _A=None						,     _A=True						,     _A=False						,     _A=[0.48_14_54_66, 0.4_57_82_75, 0.40_82_10_73]						,     _A=[0.26_86_29_54, 0.26_13_02_58, 0.27_57_77_11]						,     _A=True						,     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			size if size is not None else {"height": 2_0, "width": 2_0}
											__lowerCAmelCase							  =			parent
											__lowerCAmelCase							  =			batch_size
											__lowerCAmelCase							  =			num_channels
											__lowerCAmelCase							  =			image_size
											__lowerCAmelCase							  =			min_resolution
											__lowerCAmelCase							  =			max_resolution
											__lowerCAmelCase							  =			do_resize
											__lowerCAmelCase							  =			size
											__lowerCAmelCase							  =			do_normalize
											__lowerCAmelCase							  =			image_mean
											__lowerCAmelCase							  =			image_std
											__lowerCAmelCase							  =			do_pad
											__lowerCAmelCase							  =			do_convert_rgb






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											return {
											    "do_resize": self.do_resize,
											    "size": self.size,
											    "do_normalize": self.do_normalize,
											    "image_mean": self.image_mean,
											    "image_std": self.image_std,
											    "do_convert_rgb": self.do_convert_rgb,
											    "do_pad": self.do_pad,
											}






						def 							__SCREAMING_SNAKE_CASE(  self						,     _A=False						,     _A=False						,     _A=False     ):




											"""simple docstring"""



											assert not (numpify and torchify), "You cannot specify both numpy and PyTorch tensors at the same time"

											if equal_resolution:
																__lowerCAmelCase							  =			[]
																for i in range(self.batch_size     ):
																					image_inputs.append(
																					    np.random.randint(
																					        2_5_5						,     size=(self.num_channels, self.max_resolution, self.max_resolution)						,     dtype=np.uinta     )     )
											else:
																__lowerCAmelCase							  =			[]
																for i in range(self.batch_size     ):
																					__lowerCAmelCase  ,				__lowerCAmelCase							  =			np.random.choice(np.arange(self.min_resolution						,     self.max_resolution     )						,     2     )
																					image_inputs.append(np.random.randint(2_5_5						,     size=(self.num_channels, width, height)						,     dtype=np.uinta     )     )

											if not numpify and not torchify:
																# PIL expects the channel dimension as last dimension
																__lowerCAmelCase							  =			[Image.fromarray(np.moveaxis(_A						,     0						,     -1     )     ) for x in image_inputs]

											if torchify:
																__lowerCAmelCase							  =			[torch.from_numpy(_A     ) for x in image_inputs]

											return image_inputs






@require_torch
@require_vision
class      a__       (   snake_case__					,							unittest.TestCase ):
						_a				:       Optional[Any]   =       BlipImageProcessor if is_vision_available() else None






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			BlipImageProcessingTester(self     )






						@property
						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											return self.image_processor_tester.prepare_image_processor_dict()






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			self.image_processing_class(**self.image_processor_dict     )
											self.assertTrue(hasattr(_A						,     "do_resize"     )     )
											self.assertTrue(hasattr(_A						,     "size"     )     )
											self.assertTrue(hasattr(_A						,     "do_normalize"     )     )
											self.assertTrue(hasattr(_A						,     "image_mean"     )     )
											self.assertTrue(hasattr(_A						,     "image_std"     )     )
											self.assertTrue(hasattr(_A						,     "do_convert_rgb"     )     )






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											pass






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			self.image_processing_class(**self.image_processor_dict     )
											# create random PIL images
											__lowerCAmelCase							  =			self.image_processor_tester.prepare_inputs(equal_resolution=_A     )
											for image in image_inputs:
																self.assertIsInstance(_A						,     Image.Image     )

											# Test not batched input
											__lowerCAmelCase							  =			image_processor(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
											__lowerCAmelCase							  =			image_processor(_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 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			self.image_processing_class(**self.image_processor_dict     )
											# create random numpy tensors
											__lowerCAmelCase							  =			self.image_processor_tester.prepare_inputs(equal_resolution=_A						,     numpify=_A     )
											for image in image_inputs:
																self.assertIsInstance(_A						,     np.ndarray     )

											# Test not batched input
											__lowerCAmelCase							  =			image_processor(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
											__lowerCAmelCase							  =			image_processor(_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 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			self.image_processing_class(**self.image_processor_dict     )
											# create random PyTorch tensors
											__lowerCAmelCase							  =			self.image_processor_tester.prepare_inputs(equal_resolution=_A						,     torchify=_A     )
											for image in image_inputs:
																self.assertIsInstance(_A						,     torch.Tensor     )

											# Test not batched input
											__lowerCAmelCase							  =			image_processor(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
											__lowerCAmelCase							  =			image_processor(_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"],
											    )						,     )






@require_torch
@require_vision
class      a__       (   snake_case__					,							unittest.TestCase ):
						_a				:       Dict   =       BlipImageProcessor if is_vision_available() else None






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			BlipImageProcessingTester(self						,     num_channels=4     )
											__lowerCAmelCase							  =			3






						@property
						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											return self.image_processor_tester.prepare_image_processor_dict()






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			self.image_processing_class(**self.image_processor_dict     )
											self.assertTrue(hasattr(_A						,     "do_resize"     )     )
											self.assertTrue(hasattr(_A						,     "size"     )     )
											self.assertTrue(hasattr(_A						,     "do_normalize"     )     )
											self.assertTrue(hasattr(_A						,     "image_mean"     )     )
											self.assertTrue(hasattr(_A						,     "image_std"     )     )
											self.assertTrue(hasattr(_A						,     "do_convert_rgb"     )     )






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											pass






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			self.image_processing_class(**self.image_processor_dict     )
											# create random PIL images
											__lowerCAmelCase							  =			self.image_processor_tester.prepare_inputs(equal_resolution=_A     )
											for image in image_inputs:
																self.assertIsInstance(_A						,     Image.Image     )

											# Test not batched input
											__lowerCAmelCase							  =			image_processor(image_inputs[0]						,     return_tensors="pt"     ).pixel_values
											self.assertEqual(
											    encoded_images.shape						,     (
											        1,
											        self.expected_encoded_image_num_channels,
											        self.image_processor_tester.size["height"],
											        self.image_processor_tester.size["width"],
											    )						,     )

											# Test batched
											__lowerCAmelCase							  =			image_processor(_A						,     return_tensors="pt"     ).pixel_values
											self.assertEqual(
											    encoded_images.shape						,     (
											        self.image_processor_tester.batch_size,
											        self.expected_encoded_image_num_channels,
											        self.image_processor_tester.size["height"],
											        self.image_processor_tester.size["width"],
											    )						,     )










def       _a (		SCREAMING_SNAKE_CASE_				:							int , SCREAMING_SNAKE_CASE_				:							int	):
					if a < b:
										return gcd(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_	)
					if a % b == 0:
										return b
					return gcd(SCREAMING_SNAKE_CASE_ , a % b	)







def       _a (		SCREAMING_SNAKE_CASE_				:							int , SCREAMING_SNAKE_CASE_				:							int , SCREAMING_SNAKE_CASE_				:							int	):
					if y == 0:
										return 1
					__lowerCAmelCase							  =			power(SCREAMING_SNAKE_CASE_ , y // 2 , SCREAMING_SNAKE_CASE_	) % mod
					__lowerCAmelCase							  =			(temp * temp) % mod
					if y % 2 == 1:
										__lowerCAmelCase							  =			(temp * x) % mod
					return temp







def       _a (		SCREAMING_SNAKE_CASE_				:							int	):
					__lowerCAmelCase							  =			2
					while b < n:
										if gcd(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_	) == 1 and power(SCREAMING_SNAKE_CASE_ , n - 1 , SCREAMING_SNAKE_CASE_	) != 1:
															return False
										b += 1
					return True


if __name__ == "__main__":
					UpperCamelCase__            =     int(input("""Enter number: """).strip())
					if is_carmichael_number(number):
										print(f'''{number} is a Carmichael Number.''')
					else:
										print(f'''{number} is not a Carmichael Number.''')




