




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 CLIPImageProcessor




class  __lowerCAmelCase							(				unittest.TestCase):






       def __init__( self:       Union[str, Any]							,       _lowerCAmelCase:       Any							,       _lowerCAmelCase:       Tuple=7							,       _lowerCAmelCase:       Tuple=3							,       _lowerCAmelCase:       List[Any]=18							,       _lowerCAmelCase:       List[str]=30							,       _lowerCAmelCase:       Any=4_00							,       _lowerCAmelCase:       Optional[int]=True							,       _lowerCAmelCase:       List[str]=None							,       _lowerCAmelCase:       List[Any]=True							,       _lowerCAmelCase:       Union[str, Any]=None							,       _lowerCAmelCase:       Optional[int]=True							,       _lowerCAmelCase:       str=[0.48_14_54_66, 0.4_57_82_75, 0.40_82_10_73]							,       _lowerCAmelCase:       Optional[Any]=[0.26_86_29_54, 0.26_13_02_58, 0.27_57_77_11]							,       _lowerCAmelCase:       Optional[Any]=True							,       ):
         lowercase     :Any   						=    size if size is not None else {"shortest_edge": 20}
         lowercase     :Union[str, Any]   						=    crop_size if crop_size is not None else {"height": 18, "width": 18}
         lowercase     :Any   						=    parent
         lowercase     :List[Any]   						=    batch_size
         lowercase     :Union[str, Any]   						=    num_channels
         lowercase     :Any   						=    image_size
         lowercase     :Dict   						=    min_resolution
         lowercase     :int   						=    max_resolution
         lowercase     :Tuple   						=    do_resize
         lowercase     :Any   						=    size
         lowercase     :str   						=    do_center_crop
         lowercase     :Optional[int]   						=    crop_size
         lowercase     :str   						=    do_normalize
         lowercase     :Dict   						=    image_mean
         lowercase     :int   						=    image_std
         lowercase     :str   						=    do_convert_rgb






       def        SCREAMING_SNAKE_CASE     ( self:       Union[str, Any]					):
         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,
         }






       def        SCREAMING_SNAKE_CASE     ( self:       List[Any]							,       _lowerCAmelCase:       Optional[Any]=False							,       _lowerCAmelCase:       Tuple=False							,       _lowerCAmelCase:       str=False					):
         assert not (numpify and torchify), "You cannot specify both numpy and PyTorch tensors at the same time"

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

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

         if torchify:
           lowercase     :List[str]   						=    [torch.from_numpy(_lowerCAmelCase					) for x in image_inputs]

         return image_inputs







@require_torch
@require_vision
class  __lowerCAmelCase							(				lowerCAmelCase   ,			unittest.TestCase):
       _a			       =    CLIPImageProcessor if is_vision_available() else None






       def        SCREAMING_SNAKE_CASE     ( self:       Optional[Any]					):
         lowercase     :str   						=    CLIPImageProcessingTester(self					)






       @property
       def        SCREAMING_SNAKE_CASE     ( self:       List[str]					):
         return self.image_processor_tester.prepare_image_processor_dict()






       def        SCREAMING_SNAKE_CASE     ( self:       Tuple					):
         lowercase     :List[Any]   						=    self.image_processing_class(**self.image_processor_dict					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "do_resize"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "size"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "do_center_crop"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "center_crop"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "do_normalize"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "image_mean"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "image_std"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "do_convert_rgb"					)					)






       def        SCREAMING_SNAKE_CASE     ( self:       Optional[Any]					):
         lowercase     :int   						=    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     :Tuple   						=    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        SCREAMING_SNAKE_CASE     ( self:       List[str]					):
         pass






       def        SCREAMING_SNAKE_CASE     ( self:       List[str]					):
         # Initialize image_processing
         lowercase     :List[str]   						=    self.image_processing_class(**self.image_processor_dict					)
         # create random PIL images
         lowercase     :Dict   						=    self.image_processor_tester.prepare_inputs(equal_resolution=_lowerCAmelCase					)
         for image in image_inputs:
           self.assertIsInstance(_lowerCAmelCase							,       Image.Image					)

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

         # Test batched
         lowercase     :Optional[Any]   						=    image_processing(_lowerCAmelCase							,       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:       Optional[int]					):
         # Initialize image_processing
         lowercase     :Tuple   						=    self.image_processing_class(**self.image_processor_dict					)
         # create random numpy tensors
         lowercase     :List[Any]   						=    self.image_processor_tester.prepare_inputs(equal_resolution=_lowerCAmelCase							,       numpify=_lowerCAmelCase					)
         for image in image_inputs:
           self.assertIsInstance(_lowerCAmelCase							,       np.ndarray					)

         # Test not batched input
         lowercase     :Dict   						=    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     :List[Any]   						=    image_processing(_lowerCAmelCase							,       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:       Dict					):
         # Initialize image_processing
         lowercase     :int   						=    self.image_processing_class(**self.image_processor_dict					)
         # create random PyTorch tensors
         lowercase     :Optional[int]   						=    self.image_processor_tester.prepare_inputs(equal_resolution=_lowerCAmelCase							,       torchify=_lowerCAmelCase					)
         for image in image_inputs:
           self.assertIsInstance(_lowerCAmelCase							,       torch.Tensor					)

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

         # Test batched
         lowercase     :Optional[int]   						=    image_processing(_lowerCAmelCase							,       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"],
             )							,       )







@require_torch
@require_vision
class  __lowerCAmelCase							(				lowerCAmelCase   ,			unittest.TestCase):
       _a			       =    CLIPImageProcessor if is_vision_available() else None






       def        SCREAMING_SNAKE_CASE     ( self:       str					):
         lowercase     :List[str]   						=    CLIPImageProcessingTester(self							,       num_channels=4					)
         lowercase     :int   						=    3






       @property
       def        SCREAMING_SNAKE_CASE     ( self:       str					):
         return self.image_processor_tester.prepare_image_processor_dict()






       def        SCREAMING_SNAKE_CASE     ( self:       int					):
         lowercase     :Any   						=    self.image_processing_class(**self.image_processor_dict					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "do_resize"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "size"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "do_center_crop"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "center_crop"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "do_normalize"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "image_mean"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "image_std"					)					)
         self.assertTrue(hasattr(_lowerCAmelCase							,       "do_convert_rgb"					)					)






       def        SCREAMING_SNAKE_CASE     ( self:       Optional[int]					):
         pass






       def        SCREAMING_SNAKE_CASE     ( self:       int					):
         # Initialize image_processing
         lowercase     :int   						=    self.image_processing_class(**self.image_processor_dict					)
         # create random PIL images
         lowercase     :Optional[int]   						=    self.image_processor_tester.prepare_inputs(equal_resolution=_lowerCAmelCase					)
         for image in image_inputs:
           self.assertIsInstance(_lowerCAmelCase							,       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.expected_encoded_image_num_channels,
                 self.image_processor_tester.crop_size["height"],
                 self.image_processor_tester.crop_size["width"],
             )							,       )

         # Test batched
         lowercase     :Tuple   						=    image_processing(_lowerCAmelCase							,       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.crop_size["height"],
                 self.image_processor_tester.crop_size["width"],
             )							,       )









import decimal



def    UpperCAmelCase__	(  ):
  lowercase     :int   						=    0
  lowercase     :str   						=    decimal.Context(prec=105 )
  for i in range(2,      100 ):
    lowercase     :int   						=    decimal.Decimal(lowerCamelCase )
    lowercase     :str   						=    number.sqrt(lowerCamelCase )
    if len(str(lowerCamelCase ) ) > 1:
      answer += int(str(lowerCamelCase )[0] )
      lowercase     :int   						=    str(lowerCamelCase )[2:101]
      answer += sum(int(lowerCamelCase ) for x in sqrt_number_str )
  return answer


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     print(f'''{solution() = }''')



