

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


class 					A__      (      unittest.TestCase			):



    def __init__(					self		,				UpperCamelCase__		,				UpperCamelCase__=13		,				UpperCamelCase__=3		,				UpperCamelCase__=224		,				UpperCamelCase__=30		,				UpperCamelCase__=400		,				UpperCamelCase__=True		,				UpperCamelCase__=None		,				UpperCamelCase__=True		,				UpperCamelCase__=[0.5, 0.5, 0.5]		,				UpperCamelCase__=[0.5, 0.5, 0.5]		,				)						->      List[str]:





           '''simple docstring'''
           A_						=      size if size is not None else {"""height""": 18, """width""": 18}
           A_						=      parent
           A_						=      batch_size
           A_						=      num_channels
           A_						=      image_size
           A_						=      min_resolution
           A_						=      max_resolution
           A_						=      do_resize
           A_						=      size
           A_						=      do_normalize
           A_						=      image_mean
           A_						=      image_std







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





           '''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 					A__      (      _snake_case						,						unittest.TestCase			):
    lowercase						=		ViTImageProcessor if is_vision_available() else None



    def 					snake_case_			(					self       )						->      Optional[int]:





           '''simple docstring'''
           A_						=      EfficientFormerImageProcessorTester(self       )



    @property
    def 					snake_case_			(					self       )						->      Dict:





           '''simple docstring'''
           return self.image_proc_tester.prepare_image_processor_dict()



    def 					snake_case_			(					self       )						->      Any:





           '''simple docstring'''
           A_						=      self.image_processing_class(**self.image_processor_dict       )
           self.assertTrue(hasattr(UpperCamelCase__		,				"""image_mean"""       )       )
           self.assertTrue(hasattr(UpperCamelCase__		,				"""image_std"""       )       )
           self.assertTrue(hasattr(UpperCamelCase__		,				"""do_normalize"""       )       )
           self.assertTrue(hasattr(UpperCamelCase__		,				"""do_resize"""       )       )
           self.assertTrue(hasattr(UpperCamelCase__		,				"""size"""       )       )



    def 					snake_case_			(					self       )						->      Any:





           '''simple docstring'''
           pass



    def 					snake_case_			(					self       )						->      Optional[int]:





           '''simple docstring'''
           # Initialize image_processor
           A_						=      self.image_processing_class(**self.image_processor_dict       )
           # create random PIL images
           A_						=      prepare_image_inputs(self.image_proc_tester		,				equal_resolution=UpperCamelCase__       )
           for image in image_inputs:
                  self.assertIsInstance(UpperCamelCase__		,				Image.Image       )

           # Test not batched input
           A_						=      image_processor(image_inputs[0]		,				return_tensors="""pt"""       ).pixel_values
           self.assertEqual(
               encoded_images.shape		,				(
                   1,
                   self.image_proc_tester.num_channels,
                   self.image_proc_tester.size["""height"""],
                   self.image_proc_tester.size["""width"""],
               )		,				)

           # Test batched
           A_						=      image_processor(UpperCamelCase__		,				return_tensors="""pt"""       ).pixel_values
           self.assertEqual(
               encoded_images.shape		,				(
                   self.image_proc_tester.batch_size,
                   self.image_proc_tester.num_channels,
                   self.image_proc_tester.size["""height"""],
                   self.image_proc_tester.size["""width"""],
               )		,				)



    def 					snake_case_			(					self       )						->      Any:





           '''simple docstring'''
           # Initialize image_processor
           A_						=      self.image_processing_class(**self.image_processor_dict       )
           # create random numpy tensors
           A_						=      prepare_image_inputs(self.image_proc_tester		,				equal_resolution=UpperCamelCase__		,				numpify=UpperCamelCase__       )
           for image in image_inputs:
                  self.assertIsInstance(UpperCamelCase__		,				np.ndarray       )

           # Test not batched input
           A_						=      image_processor(image_inputs[0]		,				return_tensors="""pt"""       ).pixel_values
           self.assertEqual(
               encoded_images.shape		,				(
                   1,
                   self.image_proc_tester.num_channels,
                   self.image_proc_tester.size["""height"""],
                   self.image_proc_tester.size["""width"""],
               )		,				)

           # Test batched
           A_						=      image_processor(UpperCamelCase__		,				return_tensors="""pt"""       ).pixel_values
           self.assertEqual(
               encoded_images.shape		,				(
                   self.image_proc_tester.batch_size,
                   self.image_proc_tester.num_channels,
                   self.image_proc_tester.size["""height"""],
                   self.image_proc_tester.size["""width"""],
               )		,				)







    def 					snake_case_			(					self       )						->      Optional[int]:





           '''simple docstring'''
           # Initialize image_processor
           A_						=      self.image_processing_class(**self.image_processor_dict       )
           # create random PyTorch tensors
           A_						=      prepare_image_inputs(self.image_proc_tester		,				equal_resolution=UpperCamelCase__		,				torchify=UpperCamelCase__       )
           for image in image_inputs:
                  self.assertIsInstance(UpperCamelCase__		,				torch.Tensor       )

           # Test not batched input
           A_						=      image_processor(image_inputs[0]		,				return_tensors="""pt"""       ).pixel_values
           self.assertEqual(
               encoded_images.shape		,				(
                   1,
                   self.image_proc_tester.num_channels,
                   self.image_proc_tester.size["""height"""],
                   self.image_proc_tester.size["""width"""],
               )		,				)

           # Test batched
           A_						=      image_processor(UpperCamelCase__		,				return_tensors="""pt"""       ).pixel_values
           self.assertEqual(
               encoded_images.shape		,				(
                   self.image_proc_tester.batch_size,
                   self.image_proc_tester.num_channels,
                   self.image_proc_tester.size["""height"""],
                   self.image_proc_tester.size["""width"""],
               )		,				)



'''simple docstring'''







def       UpperCAmelCase__    (      UpperCAmelCase__				)			->			bool:
       return str(UpperCAmelCase__				) == str(UpperCAmelCase__				)[::-1]
def       UpperCAmelCase__    (      UpperCAmelCase__				)			->			int:
       return int(UpperCAmelCase__				) + int(str(UpperCAmelCase__				)[::-1]				)
def       UpperCAmelCase__    (      UpperCAmelCase__ = 1_00_00				)			->			int:
       A_						=      []
       for num in range(1,       UpperCAmelCase__				):
              A_						=      0
              A_						=      num
              while iterations < 50:
                     A_						=      sum_reverse(UpperCAmelCase__				)
                     iterations += 1
                     if is_palindrome(UpperCAmelCase__				):
                            break
              else:
                     lychrel_nums.append(UpperCAmelCase__				)
       return len(UpperCAmelCase__				)


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