




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


class 			_a  (	unittest.TestCase ):
       def __init__(	self						:	Union[str, Any]   ,				lowercase						:	Optional[Any]   ,				lowercase						:	Tuple=7   ,				lowercase						:	Tuple=3   ,				lowercase						:	Any=30   ,				lowercase						:	Tuple=400   ,				lowercase						:	List[Any]=True   ,				lowercase						:	Optional[int]=None   ,				lowercase						:	Any=0.9   ,				lowercase						:	int=None   ,				lowercase						:	List[Any]=True   ,				lowercase						:	Any=[0.5, 0.5, 0.5]   ,				lowercase						:	Union[str, Any]=[0.5, 0.5, 0.5]   ,				):



           '''simple docstring'''

           UpperCAmelCase			       =		size if size is not None else {'''shortest_edge''': 30}
           UpperCAmelCase			       =		crop_size if crop_size is not None else {'''height''': 30, '''width''': 30}
           UpperCAmelCase			       =		parent
           UpperCAmelCase			       =		batch_size
           UpperCAmelCase			       =		num_channels
           UpperCAmelCase			       =		min_resolution
           UpperCAmelCase			       =		max_resolution
           UpperCAmelCase			       =		do_resize_and_center_crop
           UpperCAmelCase			       =		size
           UpperCAmelCase			       =		crop_pct
           UpperCAmelCase			       =		crop_size
           UpperCAmelCase			       =		do_normalize
           UpperCAmelCase			       =		image_mean
           UpperCAmelCase			       =		image_std







       def     A      (	self						:	Union[str, Any]				):



           '''simple docstring'''

           return {
               "size": self.size,
               "do_resize_and_center_crop": self.do_resize_and_center_crop,
               "crop_pct": self.crop_pct,
               "crop_size": self.crop_size,
               "do_normalize": self.do_normalize,
               "image_mean": self.image_mean,
               "image_std": self.image_std,
           }






@require_torch
@require_vision
class 			_a  (	__a							,							unittest.TestCase ):
       __a				:     int   				=					PoolFormerImageProcessor if is_vision_available() else None
       def     A      (	self						:	str				):



           '''simple docstring'''

           UpperCAmelCase			       =		PoolFormerImageProcessingTester(self				)
       @property
       def     A      (	self						:	Optional[Any]				):



           '''simple docstring'''

           return self.image_processor_tester.prepare_image_processor_dict()
       def     A      (	self						:	Any				):



           '''simple docstring'''

           UpperCAmelCase			       =		self.image_processing_class(**self.image_processor_dict				)
           self.assertTrue(hasattr(lowercase   ,				'''do_resize_and_center_crop'''				)				)
           self.assertTrue(hasattr(lowercase   ,				'''size'''				)				)
           self.assertTrue(hasattr(lowercase   ,				'''crop_pct'''				)				)
           self.assertTrue(hasattr(lowercase   ,				'''do_normalize'''				)				)
           self.assertTrue(hasattr(lowercase   ,				'''image_mean'''				)				)
           self.assertTrue(hasattr(lowercase   ,				'''image_std'''				)				)
       def     A      (	self						:	Tuple				):



           '''simple docstring'''

           UpperCAmelCase			       =		self.image_processing_class.from_dict(self.image_processor_dict				)
           self.assertEqual(image_processor.size   ,				{'''shortest_edge''': 30}				)
           self.assertEqual(image_processor.crop_size   ,				{'''height''': 30, '''width''': 30}				)

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



           '''simple docstring'''

           pass
       def     A      (	self						:	str				):



           '''simple docstring'''

           UpperCAmelCase			       =		self.image_processing_class(**self.image_processor_dict				)
           # create random PIL images
           UpperCAmelCase			       =		prepare_image_inputs(self.image_processor_tester   ,				equal_resolution=lowercase				)
           for image in image_inputs:
               self.assertIsInstance(lowercase   ,				Image.Image				)

           # Test not batched input
           UpperCAmelCase			       =		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
           UpperCAmelCase			       =		image_processing(lowercase   ,				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						:	Dict				):



           '''simple docstring'''

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

           # Test not batched input
           UpperCAmelCase			       =		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
           UpperCAmelCase			       =		image_processing(lowercase   ,				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'''

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

           # Test not batched input
           UpperCAmelCase			       =		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
           UpperCAmelCase			       =		image_processing(lowercase   ,				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 math import ceil


def     __lowerCAmelCase			(			a__ = 1001  )       ->  int:
				__a										=    1

				for i in range(1						,    int(ceil(n / 2.0  )  )  ):
								__a										=    2 * i + 1
								__a										=    2 * i
								__a										=    total + 4 * odd**2 - 6 * even

				return total


if __name__ == "__main__":
					import sys

					if len(sys.argv) == 1:
										print(solution())
					else:
										try:
															A     :	List[Any]    = int(sys.argv[1])
															print(solution(n))
										except ValueError:
															print('Invalid entry - please enter a number')