



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



class 		lowerCamelCase__   (    unittest.TestCase  ):




					'''simple docstring'''



					def __init__(	self					:						int  ,	UpperCamelCase_					:						Optional[int]  ,	UpperCamelCase_					:						str=7  ,	UpperCamelCase_					:						int=3  ,	UpperCamelCase_					:						Dict=18  ,	UpperCamelCase_					:						Tuple=30  ,	UpperCamelCase_					:						List[Any]=400  ,	UpperCamelCase_					:						Dict=True  ,	UpperCamelCase_					:						List[Any]=None  ,	UpperCamelCase_					:						List[str]=True  ,	UpperCamelCase_					:						Optional[int]=None  ,	)	->							Optional[int]:



						'''simple docstring'''





						_lowercase       :							Any  	=		size if size is not None else {'shortest_edge': 20}
						_lowercase       :							Tuple  	=		crop_size if crop_size is not None else {'height': 18, 'width': 18}
						_lowercase       :							Union[str, Any]  	=		parent
						_lowercase       :							Any  	=		batch_size
						_lowercase       :							Optional[Any]  	=		num_channels
						_lowercase       :							Optional[Any]  	=		image_size
						_lowercase       :							Optional[Any]  	=		min_resolution
						_lowercase       :							Tuple  	=		max_resolution
						_lowercase       :							Tuple  	=		do_resize
						_lowercase       :							Any  	=		size
						_lowercase       :							Optional[Any]  	=		do_center_crop
						_lowercase       :							Union[str, Any]  	=		crop_size




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



						'''simple docstring'''





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






@require_torch
@require_vision
class 		lowerCamelCase__   (    A						, unittest.TestCase  ):




					'''simple docstring'''



					A_         =    MobileNetVaImageProcessor if is_vision_available() else None




					def     __UpperCAmelCase  (	self					:						List[Any]       )	->							Optional[int]:



						'''simple docstring'''





						_lowercase       :							int  	=		MobileNetVaImageProcessingTester(self       )




					@property
					def     __UpperCAmelCase  (	self					:						List[str]       )	->							List[str]:



						'''simple docstring'''





						return self.image_processor_tester.prepare_image_processor_dict()




					def     __UpperCAmelCase  (	self					:						List[str]       )	->							Any:



						'''simple docstring'''





						_lowercase       :							List[str]  	=		self.image_processing_class(**self.image_processor_dict       )
						self.assertTrue(hasattr(UpperCamelCase_  ,	'do_resize'       )       )
						self.assertTrue(hasattr(UpperCamelCase_  ,	'size'       )       )
						self.assertTrue(hasattr(UpperCamelCase_  ,	'do_center_crop'       )       )
						self.assertTrue(hasattr(UpperCamelCase_  ,	'center_crop'       )       )




					def     __UpperCAmelCase  (	self					:						Optional[int]       )	->							Any:



						'''simple docstring'''





						_lowercase       :							Union[str, Any]  	=		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}       )

						_lowercase       :							List[str]  	=		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     __UpperCAmelCase  (	self					:						str       )	->							Any:



						'''simple docstring'''





						pass




					def     __UpperCAmelCase  (	self					:						Optional[int]       )	->							int:



						'''simple docstring'''





						_lowercase       :							Union[str, Any]  	=		self.image_processing_class(**self.image_processor_dict       )
						# create random PIL images
						_lowercase       :							Optional[int]  	=		prepare_image_inputs(self.image_processor_tester  ,	equal_resolution=UpperCamelCase_       )
						for image in image_inputs:
							self.assertIsInstance(UpperCamelCase_  ,	Image.Image       )

						# Test not batched input
						_lowercase       :							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.crop_size['height'],
						        self.image_processor_tester.crop_size['width'],
						    )  ,	)

						# Test batched
						_lowercase       :							Union[str, Any]  	=		image_processing(UpperCamelCase_  ,	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     __UpperCAmelCase  (	self					:						Dict       )	->							int:



						'''simple docstring'''





						_lowercase       :							Dict  	=		self.image_processing_class(**self.image_processor_dict       )
						# create random numpy tensors
						_lowercase       :							List[str]  	=		prepare_image_inputs(self.image_processor_tester  ,	equal_resolution=UpperCamelCase_  ,	numpify=UpperCamelCase_       )
						for image in image_inputs:
							self.assertIsInstance(UpperCamelCase_  ,	np.ndarray       )

						# Test not batched input
						_lowercase       :							str  	=		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
						_lowercase       :							Union[str, Any]  	=		image_processing(UpperCamelCase_  ,	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     __UpperCAmelCase  (	self					:						List[Any]       )	->							Any:



						'''simple docstring'''





						_lowercase       :							Dict  	=		self.image_processing_class(**self.image_processor_dict       )
						# create random PyTorch tensors
						_lowercase       :							Optional[int]  	=		prepare_image_inputs(self.image_processor_tester  ,	equal_resolution=UpperCamelCase_  ,	torchify=UpperCamelCase_       )
						for image in image_inputs:
							self.assertIsInstance(UpperCamelCase_  ,	torch.Tensor       )

						# Test not batched input
						_lowercase       :							Tuple  	=		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
						_lowercase       :							int  	=		image_processing(UpperCamelCase_  ,	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'],
						    )  ,	)





'''simple docstring'''

from __future__ import annotations

import sys







def     __UpperCamelCase					(				_lowercase       )			->      int:
	if n < 0:
		raise ValueError('Negative arguments are not supported'       )
	return _fib(_lowercase       )[0]







def     __UpperCamelCase					(				_lowercase       )			->      tuple[int, int]:
	if n == 0:  # (F(0), F(1))
		return (0, 1)

	# F(2n) = F(n)[2F(n+1) − F(n)]
	# F(2n+1) = F(n+1)^2+F(n)^2
	_lowercase	,     _lowercase       :							List[str]  	=		_fib(n // 2       )
	_lowercase       :							Dict  	=		a * (b * 2 - a)
	_lowercase       :							Union[str, Any]  	=		a * a + b * b
	return (d, c + d) if n % 2 else (c, d)


if __name__ == "__main__":
		_A					:     Optional[Any]      =int(sys.argv[1])
		print(F'''fibonacci({n}) is {fibonacci(n)}''')
