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


class  UpperCamelCase__  (    unittest.TestCase):






 def __init__(			self  :Optional[int]	,				_A  :Dict	,				_A  :Dict=7	,				_A  :Tuple=3	,				_A  :str=18	,				_A  :Union[str, Any]=30	,				_A  :int=400	,				_A  :List[Any]=True	,				_A  :Dict=None	,				_A  :List[Any]=0.875	,				_A  :str=True	,				_A  :Union[str, Any]=[0.5, 0.5, 0.5]	,				_A  :str=[0.5, 0.5, 0.5]	,				)				->			Tuple:







       '''simple docstring'''



       __A       	=			size if size is not None else {'shortest_edge': 20}
       __A       	=			parent
       __A       	=			batch_size
       __A       	=			num_channels
       __A       	=			image_size
       __A       	=			min_resolution
       __A       	=			max_resolution
       __A       	=			do_resize
       __A       	=			size
       __A       	=			crop_pct
       __A       	=			do_normalize
       __A       	=			image_mean
       __A       	=			image_std






 def 	lowercase_						(			self  :Optional[Any]			)				->			List[Any]:







       '''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,
           "crop_pct": self.crop_pct,
       }


@require_torch
@require_vision
class  UpperCamelCase__  (    SCREAMING_SNAKE_CASE      ,     unittest.TestCase):
 UpperCAmelCase__    :    Tuple										=					ConvNextImageProcessor if is_vision_available() else None






 def 	lowercase_						(			self  :Any			)				->			List[Any]:







       '''simple docstring'''



       __A       	=			ConvNextImageProcessingTester(self			)






 @property
 def 	lowercase_						(			self  :Optional[int]			)				->			List[str]:







       '''simple docstring'''



       return self.image_processor_tester.prepare_image_processor_dict()






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







       '''simple docstring'''



       __A       	=			self.image_processing_class(**self.image_processor_dict			)
       self.assertTrue(hasattr(_A	,				'do_resize'			)			)
       self.assertTrue(hasattr(_A	,				'size'			)			)
       self.assertTrue(hasattr(_A	,				'crop_pct'			)			)
       self.assertTrue(hasattr(_A	,				'do_normalize'			)			)
       self.assertTrue(hasattr(_A	,				'image_mean'			)			)
       self.assertTrue(hasattr(_A	,				'image_std'			)			)






 def 	lowercase_						(			self  :int			)				->			Any:







       '''simple docstring'''



       __A       	=			self.image_processing_class.from_dict(self.image_processor_dict			)
       self.assertEqual(image_processor.size	,				{'shortest_edge': 20}			)

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






 def 	lowercase_						(			self  :List[str]			)				->			Any:







       '''simple docstring'''



       pass






 def 	lowercase_						(			self  :Tuple			)				->			Tuple:







       '''simple docstring'''



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

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

       # Test batched
       __A       	=			image_processing(_A	,				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['shortest_edge'],
               self.image_processor_tester.size['shortest_edge'],
           )	,				)






 def 	lowercase_						(			self  :Tuple			)				->			List[str]:







       '''simple docstring'''



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

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

       # Test batched
       __A       	=			image_processing(_A	,				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['shortest_edge'],
               self.image_processor_tester.size['shortest_edge'],
           )	,				)






 def 	lowercase_						(			self  :Dict			)				->			Union[str, Any]:







       '''simple docstring'''



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

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

       # Test batched
       __A       	=			image_processing(_A	,				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['shortest_edge'],
               self.image_processor_tester.size['shortest_edge'],
           )	,				)








'''simple docstring'''





def        snake_case							(		UpperCAmelCase      ,  UpperCAmelCase      ,  UpperCAmelCase	)->			str:







      """simple docstring"""
      assert b != 0, "This cannot accept modulo that is == 0"
      if n == 0:
            return 1

      if n % 2 == 1:
            return (bin_exp_mod(UpperCAmelCase      ,  n - 1      ,  UpperCAmelCase	) * a) % b

      __A       	=			bin_exp_mod(UpperCAmelCase      ,  n / 2      ,  UpperCAmelCase	)
      return (r * r) % b


if __name__ == "__main__":
 try:
  a__		:   Tuple            =       int(input("Enter Base : ").strip())
  a__		:   List[str]            =       int(input("Enter Power : ").strip())
  a__		:   Optional[Any]            =       int(input("Enter Modulo : ").strip())
 except ValueError:
  print("Invalid literal for integer")

 print(bin_exp_mod(BASE, POWER, MODULO))






