
"""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


if is_torch_available():
    import torch

if is_vision_available():
    from PIL import Image

    from transformers import TvltImageProcessor







def       __a	(						__lowerCamelCase,						__lowerCamelCase=10,						__lowerCamelCase=10,						__lowerCamelCase=False,						__lowerCamelCase=False    ):
   UpperCAmelCase_   :   List[Any]     	=       []
   for i in range(image_processor_tester.num_frames    ):
      video.append(np.random.randint(255,						size=(image_processor_tester.num_channels, width, height),						dtype=np.uinta    )    )

   if not numpify and not torchify:
      # PIL expects the channel dimension as last dimension
      UpperCAmelCase_   :   str     	=       [Image.fromarray(np.moveaxis(__lowerCamelCase,						0,						-1    )    ) for frame in video]

   if torchify:
      UpperCAmelCase_   :   str     	=       [torch.from_numpy(__lowerCamelCase    ) for frame in video]

   return video







def       __a	(						__lowerCamelCase,						__lowerCamelCase=False,						__lowerCamelCase=False,						__lowerCamelCase=False    ):
   assert not (numpify and torchify), "You cannot specify both numpy and PyTorch tensors at the same time"

   UpperCAmelCase_   :   int     	=       []
   for i in range(image_processor_tester.batch_size    ):
      if equal_resolution:
         UpperCAmelCase_   :   str     	=       image_processor_tester.max_resolution
      else:
         UpperCAmelCase_	,  UpperCAmelCase_   :   Any     	=       np.random.choice(
             np.arange(image_processor_tester.min_resolution,						image_processor_tester.max_resolution    ),						2    )
         UpperCAmelCase_   :   int     	=       prepare_video(
             image_processor_tester=__lowerCamelCase,						width=__lowerCamelCase,						height=__lowerCamelCase,						numpify=__lowerCamelCase,						torchify=__lowerCamelCase,						)
      video_inputs.append(__lowerCamelCase    )

   return video_inputs


class A_      (unittest.TestCase ):




  '''simple docstring'''







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

     """simple docstring"""
     UpperCAmelCase_   :   Union[str, Any]     	=       size if size is not None else {"shortest_edge": 18}
     UpperCAmelCase_   :   int     	=       crop_size if crop_size is not None else {"height": 18, "width": 18}

     UpperCAmelCase_   :   Dict     	=       parent
     UpperCAmelCase_   :   str     	=       batch_size
     UpperCAmelCase_   :   Tuple     	=       num_channels
     UpperCAmelCase_   :   str     	=       num_frames
     UpperCAmelCase_   :   List[str]     	=       image_size
     UpperCAmelCase_   :   int     	=       min_resolution
     UpperCAmelCase_   :   List[str]     	=       max_resolution
     UpperCAmelCase_   :   Union[str, Any]     	=       do_resize
     UpperCAmelCase_   :   str     	=       size
     UpperCAmelCase_   :   Optional[int]     	=       do_normalize
     UpperCAmelCase_   :   List[Any]     	=       image_mean
     UpperCAmelCase_   :   Tuple     	=       image_std
     UpperCAmelCase_   :   List[str]     	=       do_center_crop
     UpperCAmelCase_   :   Any     	=       crop_size







  def 			UpperCamelCase__   (						self    ):

     """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,
         "do_center_crop": self.do_center_crop,
         "crop_size": self.crop_size,
     }




@require_torch
@require_vision
class A_      (lowercase__							,unittest.TestCase ):




  '''simple docstring'''
  SCREAMING_SNAKE_CASE__     :		Dict    	=						TvltImageProcessor if is_vision_available() else None







  def 			UpperCamelCase__   (						self    ):

     """simple docstring"""
     UpperCAmelCase_   :   str     	=       TvltImageProcessorTester(self    )







  @property
  def 			UpperCamelCase__   (						self    ):

     """simple docstring"""
     return self.image_processor_tester.prepare_image_processor_dict()







  def 			UpperCamelCase__   (						self    ):

     """simple docstring"""
     UpperCAmelCase_   :   Tuple     	=       self.image_processing_class(**self.image_processor_dict    )
     self.assertTrue(hasattr(lowercase_							,  "image_mean"    )    )
     self.assertTrue(hasattr(lowercase_							,  "image_std"    )    )
     self.assertTrue(hasattr(lowercase_							,  "do_normalize"    )    )
     self.assertTrue(hasattr(lowercase_							,  "do_resize"    )    )
     self.assertTrue(hasattr(lowercase_							,  "do_center_crop"    )    )
     self.assertTrue(hasattr(lowercase_							,  "size"    )    )







  def 			UpperCamelCase__   (						self    ):

     """simple docstring"""
     # Initialize image_processor
     UpperCAmelCase_   :   Optional[int]     	=       self.image_processing_class(**self.image_processor_dict    )
     # create random PIL videos
     UpperCAmelCase_   :   Union[str, Any]     	=       prepare_video_inputs(self.image_processor_tester							,  equal_resolution=lowercase_    )
     for video in video_inputs:
        self.assertIsInstance(lowercase_							,  lowercase_    )
        self.assertIsInstance(video[0]							,  Image.Image    )

     # Test not batched input
     UpperCAmelCase_   :   List[Any]     	=       image_processor(video_inputs[0]							,  return_tensors="pt"    ).pixel_values
     self.assertEqual(
         encoded_videos.shape							,  (
             1,
             self.image_processor_tester.num_frames,
             self.image_processor_tester.num_channels,
             self.image_processor_tester.crop_size["height"],
             self.image_processor_tester.crop_size["width"],
         )							,  )

     # Test batched
     UpperCAmelCase_   :   int     	=       image_processor(lowercase_							,  return_tensors="pt"    ).pixel_values
     self.assertEqual(
         encoded_videos.shape							,  (
             self.image_processor_tester.batch_size,
             self.image_processor_tester.num_frames,
             self.image_processor_tester.num_channels,
             self.image_processor_tester.crop_size["height"],
             self.image_processor_tester.crop_size["width"],
         )							,  )







  def 			UpperCamelCase__   (						self    ):

     """simple docstring"""
     # Initialize image_processor
     UpperCAmelCase_   :   Tuple     	=       self.image_processing_class(**self.image_processor_dict    )
     # create random numpy tensors
     UpperCAmelCase_   :   List[Any]     	=       prepare_video_inputs(self.image_processor_tester							,  equal_resolution=lowercase_							,  numpify=lowercase_    )
     for video in video_inputs:
        self.assertIsInstance(lowercase_							,  lowercase_    )
        self.assertIsInstance(video[0]							,  np.ndarray    )

     # Test not batched input
     UpperCAmelCase_   :   Optional[int]     	=       image_processor(video_inputs[0]							,  return_tensors="pt"    ).pixel_values
     self.assertEqual(
         encoded_videos.shape							,  (
             1,
             self.image_processor_tester.num_frames,
             self.image_processor_tester.num_channels,
             self.image_processor_tester.crop_size["height"],
             self.image_processor_tester.crop_size["width"],
         )							,  )

     # Test batched
     UpperCAmelCase_   :   List[str]     	=       image_processor(lowercase_							,  return_tensors="pt"    ).pixel_values
     self.assertEqual(
         encoded_videos.shape							,  (
             self.image_processor_tester.batch_size,
             self.image_processor_tester.num_frames,
             self.image_processor_tester.num_channels,
             self.image_processor_tester.crop_size["height"],
             self.image_processor_tester.crop_size["width"],
         )							,  )







  def 			UpperCamelCase__   (						self    ):

     """simple docstring"""
     # Initialize image_processor
     UpperCAmelCase_   :   int     	=       self.image_processing_class(**self.image_processor_dict    )
     # create random PyTorch tensors
     UpperCAmelCase_   :   Optional[int]     	=       prepare_video_inputs(self.image_processor_tester							,  equal_resolution=lowercase_							,  torchify=lowercase_    )
     for video in video_inputs:
        self.assertIsInstance(lowercase_							,  lowercase_    )
        self.assertIsInstance(video[0]							,  torch.Tensor    )

     # Test not batched input
     UpperCAmelCase_   :   Tuple     	=       image_processor(video_inputs[0]							,  return_tensors="pt"    ).pixel_values
     self.assertEqual(
         encoded_videos.shape							,  (
             1,
             self.image_processor_tester.num_frames,
             self.image_processor_tester.num_channels,
             self.image_processor_tester.crop_size["height"],
             self.image_processor_tester.crop_size["width"],
         )							,  )

     # Test batched
     UpperCAmelCase_   :   str     	=       image_processor(lowercase_							,  return_tensors="pt"    ).pixel_values
     self.assertEqual(
         encoded_videos.shape							,  (
             self.image_processor_tester.batch_size,
             self.image_processor_tester.num_frames,
             self.image_processor_tester.num_channels,
             self.image_processor_tester.crop_size["height"],
             self.image_processor_tester.crop_size["width"],
         )							,  )








def    snake_case   (				A		,  A     )				->				int:




	'''simple docstring'''


	if a < b:
		return gcd(A		,  A     )
	if a % b == 0:
		return b
	return gcd(A		,  a % b     )






def    snake_case   (				A		,  A		,  A     )				->				int:




	'''simple docstring'''


	if y == 0:
		return 1
	lowerCamelCase_				:						int				  =				power(A		,  y // 2		,  A     ) % mod
	lowerCamelCase_				:						List[Any]				  =				(temp * temp) % mod
	if y % 2 == 1:
		lowerCamelCase_				:						str				  =				(temp * x) % mod
	return temp






def    snake_case   (				A     )				->				bool:




	'''simple docstring'''


	lowerCamelCase_				:						Union[str, Any]				  =				2
	while b < n:
		if gcd(A		,  A     ) == 1 and power(A		,  n - 1		,  A     ) != 1:
			return False
		b += 1
	return True


if __name__ == "__main__":
							UpperCamelCase__						=		int(input('Enter number: ').strip())
							if is_carmichael_number(number):
														print(F'{number} is a Carmichael Number.')
							else:
														print(F'{number} is not a Carmichael Number.')
