




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						:	Optional[int]       ,       _lowerCAmelCase						:	Union[str, Any]       ,       _lowerCAmelCase						:	Union[str, Any]=7       ,       _lowerCAmelCase						:	Optional[int]=3       ,       _lowerCAmelCase						:	Tuple=18       ,       _lowerCAmelCase						:	str=30       ,       _lowerCAmelCase						:	Optional[Any]=400       ,       _lowerCAmelCase						:	Union[str, Any]=True       ,       _lowerCAmelCase						:	str=None       ,       _lowerCAmelCase						:	str=True       ,       _lowerCAmelCase						:	int=None       ,       ):
       SCREAMING_SNAKE_CASE_					=    size if size is not None else {'shortest_edge': 20}
       SCREAMING_SNAKE_CASE_					=    crop_size if crop_size is not None else {'height': 18, 'width': 18}
       SCREAMING_SNAKE_CASE_					=    parent
       SCREAMING_SNAKE_CASE_					=    batch_size
       SCREAMING_SNAKE_CASE_					=    num_channels
       SCREAMING_SNAKE_CASE_					=    image_size
       SCREAMING_SNAKE_CASE_					=    min_resolution
       SCREAMING_SNAKE_CASE_					=    max_resolution
       SCREAMING_SNAKE_CASE_					=    do_resize
       SCREAMING_SNAKE_CASE_					=    size
       SCREAMING_SNAKE_CASE_					=    do_center_crop
       SCREAMING_SNAKE_CASE_					=    crop_size




 def    lowerCAmelCase_						(							self						:	Optional[int]		):
       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_							(   _SCREAMING_SNAKE_CASE ,     unittest.TestCase      ):


 '''simple docstring'''







 lowercase_       					=					MobileNetVaImageProcessor if is_vision_available() else None



 def    lowerCAmelCase_						(							self						:	Dict		):
       SCREAMING_SNAKE_CASE_					=    MobileNetVaImageProcessingTester(self		)



 @property
 def    lowerCAmelCase_						(							self						:	Dict		):
       return self.image_processor_tester.prepare_image_processor_dict()



 def    lowerCAmelCase_						(							self						:	Dict		):
       SCREAMING_SNAKE_CASE_					=    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'		)		)



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

       SCREAMING_SNAKE_CASE_					=    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    lowerCAmelCase_						(							self						:	int		):
       pass



 def    lowerCAmelCase_						(							self						:	str		):
       # Initialize image_processing
       SCREAMING_SNAKE_CASE_					=    self.image_processing_class(**self.image_processor_dict		)
       # create random PIL images
       SCREAMING_SNAKE_CASE_					=    prepare_image_inputs(self.image_processor_tester       ,       equal_resolution=_lowerCAmelCase		)
       for image in image_inputs:
             self.assertIsInstance(_lowerCAmelCase       ,       Image.Image		)

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

       # Test not batched input
       SCREAMING_SNAKE_CASE_					=    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
       SCREAMING_SNAKE_CASE_					=    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    lowerCAmelCase_						(							self						:	int		):
       # Initialize image_processing
       SCREAMING_SNAKE_CASE_					=    self.image_processing_class(**self.image_processor_dict		)
       # create random PyTorch tensors
       SCREAMING_SNAKE_CASE_					=    prepare_image_inputs(self.image_processor_tester       ,       equal_resolution=_lowerCAmelCase       ,       torchify=_lowerCAmelCase		)
       for image in image_inputs:
             self.assertIsInstance(_lowerCAmelCase       ,       torch.Tensor		)

       # Test not batched input
       SCREAMING_SNAKE_CASE_					=    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
       SCREAMING_SNAKE_CASE_					=    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'],
           )       ,       )





from collections import defaultdict

def       UpperCAmelCase_							(   __UpperCAmelCase		:			int = 5							)      ->				int:
      SCREAMING_SNAKE_CASE_					=    defaultdict(__UpperCAmelCase							)
      SCREAMING_SNAKE_CASE_					=    0

      while True:
            SCREAMING_SNAKE_CASE_					=    get_digits(__UpperCAmelCase							)
            freqs[digits].append(__UpperCAmelCase							)

            if len(freqs[digits]							) == max_base:
                  SCREAMING_SNAKE_CASE_					=    freqs[digits][0] ** 3
                  return base

            num += 1

def       UpperCAmelCase_							(   __UpperCAmelCase		:			int							)      ->				str:
      return "".join(sorted(str(num**3							)							)							)


if __name__ == "__main__":
   print(f'''{solution() = }''')