


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





class _snake_case (			unittest.TestCase ):
							"""simple docstring"""





							def __init__( self      ,					__A      ,					__A=13      ,					__A=3      ,					__A=18      ,					__A=30      ,					__A=400      ,					__A=True      ,					__A=None      ,					__A=True      ,					__A=[0.5, 0.5, 0.5]      ,					__A=[0.5, 0.5, 0.5]      ,					)  ->int:



											"""simple docstring"""







											__lowerCamelCase		:   Tuple           =       size if size is not None else {"height": 18, "width": 18}
											__lowerCamelCase		:   List[str]           =       parent
											__lowerCamelCase		:   Optional[Any]           =       batch_size
											__lowerCamelCase		:   str           =       num_channels
											__lowerCamelCase		:   List[Any]           =       image_size
											__lowerCamelCase		:   Dict           =       min_resolution
											__lowerCamelCase		:   Optional[int]           =       max_resolution
											__lowerCamelCase		:   Union[str, Any]           =       do_resize
											__lowerCamelCase		:   List[Any]           =       size
											__lowerCamelCase		:   List[Any]           =       do_normalize
											__lowerCamelCase		:   str           =       image_mean
											__lowerCamelCase		:   Union[str, Any]           =       image_std







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Optional[Any]:



											"""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 _snake_case (			A_     , unittest.TestCase ):
							"""simple docstring"""





							__a				       =  EfficientNetImageProcessor if is_vision_available() else None







							def 		__SCREAMING_SNAKE_CASE( self						)  ->List[str]:



											"""simple docstring"""







											__lowerCamelCase		:   Any           =       EfficientNetImageProcessorTester(self						)







							@property
							def 		__SCREAMING_SNAKE_CASE( self						)  ->Optional[Any]:



											"""simple docstring"""







											return self.image_processor_tester.prepare_image_processor_dict()







							def 		__SCREAMING_SNAKE_CASE( self						)  ->str:



											"""simple docstring"""







											__lowerCamelCase		:   Optional[int]           =       self.image_processing_class(**self.image_processor_dict						)
											self.assertTrue(hasattr(A_      ,					"image_mean"						)						)
											self.assertTrue(hasattr(A_      ,					"image_std"						)						)
											self.assertTrue(hasattr(A_      ,					"do_normalize"						)						)
											self.assertTrue(hasattr(A_      ,					"do_resize"						)						)
											self.assertTrue(hasattr(A_      ,					"size"						)						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Dict:



											"""simple docstring"""







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

											__lowerCamelCase		:   List[Any]           =       self.image_processing_class.from_dict(self.image_processor_dict      ,					size=42						)
											self.assertEqual(image_processor.size      ,					{"height": 42, "width": 42}						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->List[str]:



											"""simple docstring"""







											__lowerCamelCase		:   Union[str, Any]           =       self.image_processing_class(**self.image_processor_dict						)
											# create random PIL images
											__lowerCamelCase		:   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
											__lowerCamelCase		:   List[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.size["height"],
											        self.image_processor_tester.size["width"],
											    )      ,					)

											# Test batched
											__lowerCamelCase		:   List[str]           =       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 		__SCREAMING_SNAKE_CASE( self						)  ->List[str]:



											"""simple docstring"""







											__lowerCamelCase		:   str           =       self.image_processing_class(**self.image_processor_dict						)
											# create random numpy tensors
											__lowerCamelCase		:   List[Any]           =       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
											__lowerCamelCase		:   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
											__lowerCamelCase		:   Optional[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 		__SCREAMING_SNAKE_CASE( self						)  ->Dict:



											"""simple docstring"""







											__lowerCamelCase		:   Any           =       self.image_processing_class(**self.image_processor_dict						)
											# create random PyTorch tensors
											__lowerCamelCase		:   List[Any]           =       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
											__lowerCamelCase		:   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.size["height"],
											        self.image_processor_tester.size["width"],
											    )      ,					)

											# Test batched
											__lowerCamelCase		:   List[str]           =       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"],
											    )      ,					)









import math

def 		_UpperCAmelCase							(     SCREAMING_SNAKE_CASE__     :   int							):
     __UpperCamelCase       				=math.log(2     ,	10							) * number
     __UpperCamelCase       				=round((log_number - int(SCREAMING_SNAKE_CASE__							))     ,	15							)

     return difference

def 		_UpperCAmelCase							(     SCREAMING_SNAKE_CASE__     :   int = 67_89_10							):
     __UpperCamelCase       				=90
     __UpperCamelCase       				=0

     __UpperCamelCase       				=math.log(1.23     ,	10							)
     __UpperCamelCase       				=math.log(1.24     ,	10							)
     __UpperCamelCase       				=0

     while position < number:
          __UpperCamelCase       				=log_difference(SCREAMING_SNAKE_CASE__							)

          if difference >= upper_limit:
               power_iterator += 93

          elif difference < lower_limit:
               power_iterator += 1_96

          else:
               __UpperCamelCase       				=power_iterator
               power_iterator += 1_96
               position += 1

     return previous_power


if __name__ == "__main__":
   import doctest

   doctest.testmod()

   print(f"""{solution() = }""")





