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


if is_torch_available():
  import torch

if is_vision_available():
  from PIL import Image

  from transformers import VideoMAEImageProcessor




class 	__UpperCAmelCase				(				unittest.TestCase     ):





       '''simple docstring'''



       def __init__(      self    ,     _SCREAMING_SNAKE_CASE    ,     _SCREAMING_SNAKE_CASE=7    ,     _SCREAMING_SNAKE_CASE=3    ,     _SCREAMING_SNAKE_CASE=10    ,     _SCREAMING_SNAKE_CASE=18    ,     _SCREAMING_SNAKE_CASE=30    ,     _SCREAMING_SNAKE_CASE=400    ,     _SCREAMING_SNAKE_CASE=True    ,     _SCREAMING_SNAKE_CASE=None    ,     _SCREAMING_SNAKE_CASE=True    ,     _SCREAMING_SNAKE_CASE=[0.5, 0.5, 0.5]    ,     _SCREAMING_SNAKE_CASE=[0.5, 0.5, 0.5]    ,     _SCREAMING_SNAKE_CASE=None    ,     )		->     Tuple:
           A_     =   size if size is not None else {'''shortest_edge''': 18}
           A_     =   crop_size if crop_size is not None else {'''height''': 18, '''width''': 18}

           A_     =   parent
           A_     =   batch_size
           A_     =   num_channels
           A_     =   num_frames
           A_     =   image_size
           A_     =   min_resolution
           A_     =   max_resolution
           A_     =   do_resize
           A_     =   size
           A_     =   do_normalize
           A_     =   image_mean
           A_     =   image_std
           A_     =   crop_size

       def 					__A       (      self )		->     str:
           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_size": self.crop_size,
           }




@require_torch
@require_vision
class 	__UpperCAmelCase				(				_lowerCAmelCase						,      unittest.TestCase     ):





       '''simple docstring'''



       __lowercase					:					List[Any]    =				VideoMAEImageProcessor if is_vision_available() else None

       def 					__A       (      self )		->     Union[str, Any]:
           A_     =   VideoMAEImageProcessingTester(self )

       @property
       def 					__A       (      self )		->     Dict:
           return self.image_processor_tester.prepare_image_processor_dict()

       def 					__A       (      self )		->     int:
           A_     =   self.image_processing_class(**self.image_processor_dict )
           self.assertTrue(hasattr(A__    ,     '''image_mean''' ) )
           self.assertTrue(hasattr(A__    ,     '''image_std''' ) )
           self.assertTrue(hasattr(A__    ,     '''do_normalize''' ) )
           self.assertTrue(hasattr(A__    ,     '''do_resize''' ) )
           self.assertTrue(hasattr(A__    ,     '''do_center_crop''' ) )
           self.assertTrue(hasattr(A__    ,     '''size''' ) )

       def 					__A       (      self )		->     Union[str, Any]:
           A_     =   self.image_processing_class.from_dict(self.image_processor_dict )
           self.assertEqual(image_processor.size    ,     {'''shortest_edge''': 18} )
           self.assertEqual(image_processor.crop_size    ,     {'''height''': 18, '''width''': 18} )

           A_     =   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 					__A       (      self )		->     Any:
           pass

       def 					__A       (      self )		->     Dict:
           # Initialize image_processing
           A_     =   self.image_processing_class(**self.image_processor_dict )
           # create random PIL videos
           A_     =   prepare_video_inputs(self.image_processor_tester    ,     equal_resolution=A__ )
           for video in video_inputs:
               self.assertIsInstance(A__    ,     A__ )
               self.assertIsInstance(video[0]    ,     Image.Image )

           # Test not batched input
           A_     =   image_processing(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
           A_     =   image_processing(A__    ,     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 					__A       (      self )		->     Union[str, Any]:
           # Initialize image_processing
           A_     =   self.image_processing_class(**self.image_processor_dict )
           # create random numpy tensors
           A_     =   prepare_video_inputs(self.image_processor_tester    ,     equal_resolution=A__    ,     numpify=A__ )
           for video in video_inputs:
               self.assertIsInstance(A__    ,     A__ )
               self.assertIsInstance(video[0]    ,     np.ndarray )

           # Test not batched input
           A_     =   image_processing(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
           A_     =   image_processing(A__    ,     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 					__A       (      self )		->     Optional[int]:
           # Initialize image_processing
           A_     =   self.image_processing_class(**self.image_processor_dict )
           # create random PyTorch tensors
           A_     =   prepare_video_inputs(self.image_processor_tester    ,     equal_resolution=A__    ,     torchify=A__ )
           for video in video_inputs:
               self.assertIsInstance(A__    ,     A__ )
               self.assertIsInstance(video[0]    ,     torch.Tensor )

           # Test not batched input
           A_     =   image_processing(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
           A_     =   image_processing(A__    ,     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 	lowerCAmelCase_	(     lowerCamelCase:				int  )    ->	int:


      '''simple docstring'''




      return n * (2 * n - 1)

def 	lowerCAmelCase_	(     lowerCamelCase:				int  )    ->	bool:


      '''simple docstring'''




      lowerCamelCase__					     = (1 + 24 * n) ** 0.5
      return ((1 + root) / 6) % 1 == 0

def 	lowerCAmelCase_	(     lowerCamelCase:				int = 1_44  )    ->	int:


      '''simple docstring'''




      lowerCamelCase__					     = start
      lowerCamelCase__					     = hexagonal_num(lowerCamelCase  )
      while not is_pentagonal(lowerCamelCase  ):
            n += 1
            lowerCamelCase__					     = hexagonal_num(lowerCamelCase  )
      return num


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