





"""simple docstring"""



import unittest

import numpy as np

from transformers.testing_utils import is_flaky, 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 DonutImageProcessor






class 		__snake_case (		unittest.TestCase					):





 """simple docstring"""


 def __init__(   self ,						__lowerCamelCase ,						__lowerCamelCase=7 ,						__lowerCamelCase=3 ,						__lowerCamelCase=18 ,						__lowerCamelCase=30 ,						__lowerCamelCase=400 ,						__lowerCamelCase=True ,						__lowerCamelCase=None ,						__lowerCamelCase=True ,						__lowerCamelCase=False ,						__lowerCamelCase=True ,						__lowerCamelCase=True ,						__lowerCamelCase=[0.5, 0.5, 0.5] ,						__lowerCamelCase=[0.5, 0.5, 0.5] ,						):



     '''simple docstring'''




     __A   :						Dict									=					parent
     __A   :						Any									=					batch_size
     __A   :						Any									=					num_channels
     __A   :						str									=					image_size
     __A   :						Union[str, Any]									=					min_resolution
     __A   :						Optional[Any]									=					max_resolution
     __A   :						str									=					do_resize
     __A   :						List[str]									=					size if size is not None else {'''height''': 18, '''width''': 20}
     __A   :						str									=					do_thumbnail
     __A   :						List[Any]									=					do_align_axis
     __A   :						List[str]									=					do_pad
     __A   :						Optional[Any]									=					do_normalize
     __A   :						Union[str, Any]									=					image_mean
     __A   :						List[Any]									=					image_std







 def  UpperCamelCase__(   self  ):



     '''simple docstring'''




     return {
         "do_resize": self.do_resize,
         "size": self.size,
         "do_thumbnail": self.do_thumbnail,
         "do_align_long_axis": self.do_align_axis,
         "do_pad": self.do_pad,
         "do_normalize": self.do_normalize,
         "image_mean": self.image_mean,
         "image_std": self.image_std,
     }






@require_torch
@require_vision
class 		__snake_case (		SCREAMING_SNAKE_CASE__							,							unittest.TestCase					):





 """simple docstring"""


 _lowerCamelCase				=					DonutImageProcessor if is_vision_available() else None

 def  UpperCamelCase__(   self  ):



     '''simple docstring'''




     __A   :						str									=					DonutImageProcessingTester(self  )

 @property
 def  UpperCamelCase__(   self  ):



     '''simple docstring'''




     return self.image_processor_tester.prepare_image_processor_dict()

 def  UpperCamelCase__(   self  ):



     '''simple docstring'''




     __A   :						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_thumbnail'''  )  )
     self.assertTrue(hasattr(__lowerCamelCase ,						'''do_align_long_axis'''  )  )
     self.assertTrue(hasattr(__lowerCamelCase ,						'''do_pad'''  )  )
     self.assertTrue(hasattr(__lowerCamelCase ,						'''do_normalize'''  )  )
     self.assertTrue(hasattr(__lowerCamelCase ,						'''image_mean'''  )  )
     self.assertTrue(hasattr(__lowerCamelCase ,						'''image_std'''  )  )

 def  UpperCamelCase__(   self  ):



     '''simple docstring'''




     __A   :						Optional[int]									=					self.image_processing_class.from_dict(self.image_processor_dict  )
     self.assertEqual(image_processor.size ,						{'''height''': 18, '''width''': 20}  )

     __A   :						Any									=					self.image_processing_class.from_dict(self.image_processor_dict ,						size=42  )
     self.assertEqual(image_processor.size ,						{'''height''': 42, '''width''': 42}  )

     # Previous config had dimensions in (width, height) order
     __A   :						Union[str, Any]									=					self.image_processing_class.from_dict(self.image_processor_dict ,						size=(42, 84)  )
     self.assertEqual(image_processor.size ,						{'''height''': 84, '''width''': 42}  )

 def  UpperCamelCase__(   self  ):



     '''simple docstring'''




     pass

 @is_flaky()
 def  UpperCamelCase__(   self  ):



     '''simple docstring'''




     __A   :						Optional[Any]									=					self.image_processing_class(**self.image_processor_dict  )
     # create random PIL images
     __A   :						Any									=					prepare_image_inputs(self.image_processor_tester ,						equal_resolution=__lowerCamelCase  )
     for image in image_inputs:
         self.assertIsInstance(__lowerCamelCase ,						Image.Image  )

     # Test not batched input
     __A   :						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
     __A   :						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.size['''height'''],
             self.image_processor_tester.size['''width'''],
         ) ,						)

 @is_flaky()
 def  UpperCamelCase__(   self  ):



     '''simple docstring'''




     __A   :						str									=					self.image_processing_class(**self.image_processor_dict  )
     # create random numpy tensors
     __A   :						Dict									=					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
     __A   :						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
     __A   :						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.size['''height'''],
             self.image_processor_tester.size['''width'''],
         ) ,						)







 @is_flaky()
 def  UpperCamelCase__(   self  ):



     '''simple docstring'''




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











"""simple docstring"""



def 		__lowercase					(       )       ->Tuple:



    '''simple docstring'''







    __A   :						str									=					[]
    __A   :						List[Any]									=					1

    while len(snake_case_						) < 1e6:
        constant.append(str(snake_case_						)						)
        i += 1

    __A   :						Any									=					''''''.join(snake_case_						)

    return (
        int(constant[0]						)
        * int(constant[9]						)
        * int(constant[99]						)
        * int(constant[999]						)
        * int(constant[9999]						)
        * int(constant[99999]						)
        * int(constant[999999]						)
    )


if __name__ == "__main__":
       print(solution())




