






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 OwlViTImageProcessor

class        snake_case_				(							unittest.TestCase   ):







   """simple docstring"""



   def __init__(     self:						List[Any] ,							snake_case__:						Optional[Any] ,							snake_case__:						Dict=7 ,							snake_case__:						int=3 ,							snake_case__:						List[str]=18 ,							snake_case__:						List[Any]=30 ,							snake_case__:						Union[str, Any]=400 ,							snake_case__:						Any=True ,							snake_case__:						Tuple=None ,							snake_case__:						List[str]=True ,							snake_case__:						Any=None ,							snake_case__:						List[str]=True ,							snake_case__:						int=[0.48_14_54_66, 0.4_57_82_75, 0.40_82_10_73] ,							snake_case__:						str=[0.26_86_29_54, 0.26_13_02_58, 0.27_57_77_11] ,							snake_case__:						Dict=True ,							)	->		int:


       """simple docstring"""



       _lowercase     			=						parent
       _lowercase     			=						batch_size
       _lowercase     			=						num_channels
       _lowercase     			=						image_size
       _lowercase     			=						min_resolution
       _lowercase     			=						max_resolution
       _lowercase     			=						do_resize
       _lowercase     			=						size if size is not None else {'height': 18, 'width': 18}
       _lowercase     			=						do_center_crop
       _lowercase     			=						crop_size if crop_size is not None else {'height': 18, 'width': 18}
       _lowercase     			=						do_normalize
       _lowercase     			=						image_mean
       _lowercase     			=						image_std
       _lowercase     			=						do_convert_rgb

   def       SCREAMING_SNAKE_CASE__					(     self:						Optional[Any]						)	->		Tuple:


       """simple docstring"""



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






@require_torch
@require_vision
class        snake_case_				(							lowercase_   ,      unittest.TestCase   ):







   """simple docstring"""



   __lowerCAmelCase  =    OwlViTImageProcessor if is_vision_available() else None

   def       SCREAMING_SNAKE_CASE__					(     self:						Union[str, Any]						)	->		Optional[int]:


       """simple docstring"""



       _lowercase     			=						OwlViTImageProcessingTester(self						)

   @property
   def       SCREAMING_SNAKE_CASE__					(     self:						Optional[Any]						)	->		List[str]:


       """simple docstring"""



       return self.image_processor_tester.prepare_image_processor_dict()

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


       """simple docstring"""



       _lowercase     			=						self.image_processing_class(**self.image_processor_dict						)
       self.assertTrue(hasattr(snake_case__ ,							'do_resize'						)						)
       self.assertTrue(hasattr(snake_case__ ,							'size'						)						)
       self.assertTrue(hasattr(snake_case__ ,							'do_center_crop'						)						)
       self.assertTrue(hasattr(snake_case__ ,							'center_crop'						)						)
       self.assertTrue(hasattr(snake_case__ ,							'do_normalize'						)						)
       self.assertTrue(hasattr(snake_case__ ,							'image_mean'						)						)
       self.assertTrue(hasattr(snake_case__ ,							'image_std'						)						)
       self.assertTrue(hasattr(snake_case__ ,							'do_convert_rgb'						)						)

   def       SCREAMING_SNAKE_CASE__					(     self:						Any						)	->		Tuple:


       """simple docstring"""



       _lowercase     			=						self.image_processing_class.from_dict(self.image_processor_dict						)
       self.assertEqual(image_processor.size ,							{'height': 18, 'width': 18}						)
       self.assertEqual(image_processor.crop_size ,							{'height': 18, 'width': 18}						)

       _lowercase     			=						self.image_processing_class.from_dict(self.image_processor_dict ,							size=42 ,							crop_size=84						)
       self.assertEqual(image_processor.size ,							{'height': 42, 'width': 42}						)
       self.assertEqual(image_processor.crop_size ,							{'height': 84, 'width': 84}						)

   def       SCREAMING_SNAKE_CASE__					(     self:						int						)	->		Any:


       """simple docstring"""



       _lowercase     			=						self.image_processing_class(**self.image_processor_dict						)
       # create random PIL images
       _lowercase     			=						prepare_image_inputs(self.image_processor_tester ,							equal_resolution=snake_case__						)

       for image in image_inputs:
           self.assertIsInstance(snake_case__ ,							Image.Image						)

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


       """simple docstring"""



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

       # Test not batched input
       _lowercase     			=						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     			=						image_processing(snake_case__ ,							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       SCREAMING_SNAKE_CASE__					(     self:						List[Any]						)	->		int:


       """simple docstring"""



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

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








import math
def 							UpperCAmelCase   ( _lowercase   ):


    '''simple docstring'''



    _lowercase     			=						math.log(2,   10   ) * number
    _lowercase     			=						round((log_number - int(_lowercase   )),   15   )

    return difference
def 							UpperCAmelCase   ( _lowercase = 678910   ):


    '''simple docstring'''



    _lowercase     			=						90
    _lowercase     			=						0

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

    while position < number:
        _lowercase     			=						log_difference(_lowercase   )

        if difference >= upper_limit:
            power_iterator += 93

        elif difference < lower_limit:
            power_iterator += 196

        else:
            _lowercase     			=						power_iterator
            power_iterator += 196
            position += 1

    return previous_power


if __name__ == "__main__":
   import doctest

   doctest.testmod()

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