code: 
  
  
  
  
  
  
  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     __a						(					unittest.TestCase ):
  
  
  
  
  
  
  
   def __init__(	self      :     List[str]							,     SCREAMING_SNAKE_CASE      :     List[str]							,     SCREAMING_SNAKE_CASE      :     int=7							,     SCREAMING_SNAKE_CASE      :     List[str]=3							,     SCREAMING_SNAKE_CASE      :     Union[str, Any]=10							,     SCREAMING_SNAKE_CASE      :     Tuple=18							,     SCREAMING_SNAKE_CASE      :     Tuple=30							,     SCREAMING_SNAKE_CASE      :     Tuple=4_00							,     SCREAMING_SNAKE_CASE      :     Any=True							,     SCREAMING_SNAKE_CASE      :     int=None							,     SCREAMING_SNAKE_CASE      :     Optional[Any]=True							,     SCREAMING_SNAKE_CASE      :     Any=[0.5, 0.5, 0.5]							,     SCREAMING_SNAKE_CASE      :     Any=[0.5, 0.5, 0.5]							,     SCREAMING_SNAKE_CASE      :     Any=None							,     ):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     List[str]        =						size if size is not None else {"shortest_edge": 18}
        UpperCamelCase__    :     Tuple        =						crop_size if crop_size is not None else {"height": 18, "width": 18}
  
        UpperCamelCase__    :     Any        =						parent
        UpperCamelCase__    :     int        =						batch_size
        UpperCamelCase__    :     str        =						num_channels
        UpperCamelCase__    :     List[Any]        =						num_frames
        UpperCamelCase__    :     List[Any]        =						image_size
        UpperCamelCase__    :     List[Any]        =						min_resolution
        UpperCamelCase__    :     str        =						max_resolution
        UpperCamelCase__    :     Optional[int]        =						do_resize
        UpperCamelCase__    :     Optional[int]        =						size
        UpperCamelCase__    :     Optional[int]        =						do_normalize
        UpperCamelCase__    :     Dict        =						image_mean
        UpperCamelCase__    :     Optional[Any]        =						image_std
        UpperCamelCase__    :     int        =						crop_size
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     Dict		):
  
  
        '''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_size": self.crop_size,
        }
  
  
  
  
  
  
  
  @require_torch
  @require_vision
  class     __a						(					A__ ,     unittest.TestCase ):
   _lowerCAmelCase : Union[str, Any] 				=				VideoMAEImageProcessor if is_vision_available() else None
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     Any		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     Any        =						VideoMAEImageProcessingTester(self		)
  
  
  
  
  
  
  
   @property
   def       __lowercase      (	self      :     str		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        return self.image_processor_tester.prepare_image_processor_dict()
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     Dict		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     Optional[int]        =						self.image_processing_class(**self.image_processor_dict		)
        self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,     "image_mean"		)		)
        self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,     "image_std"		)		)
        self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,     "do_normalize"		)		)
        self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,     "do_resize"		)		)
        self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,     "do_center_crop"		)		)
        self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,     "size"		)		)
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     str		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     List[Any]        =						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}		)
  
        UpperCamelCase__    :     Union[str, Any]        =						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       __lowercase      (	self      :     Any		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        pass
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     int		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     Optional[Any]        =						self.image_processing_class(**self.image_processor_dict		)
        # create random PIL videos
        UpperCamelCase__    :     Optional[Any]        =						prepare_video_inputs(self.image_processor_tester							,     equal_resolution=SCREAMING_SNAKE_CASE		)
        for video in video_inputs:
             self.assertIsInstance(SCREAMING_SNAKE_CASE							,     SCREAMING_SNAKE_CASE		)
             self.assertIsInstance(video[0]							,     Image.Image		)
  
        # Test not batched input
        UpperCamelCase__    :     List[Any]        =						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
        UpperCamelCase__    :     Any        =						image_processing(SCREAMING_SNAKE_CASE							,     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       __lowercase      (	self      :     Dict		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     Tuple        =						self.image_processing_class(**self.image_processor_dict		)
        # create random numpy tensors
        UpperCamelCase__    :     Dict        =						prepare_video_inputs(self.image_processor_tester							,     equal_resolution=SCREAMING_SNAKE_CASE							,     numpify=SCREAMING_SNAKE_CASE		)
        for video in video_inputs:
             self.assertIsInstance(SCREAMING_SNAKE_CASE							,     SCREAMING_SNAKE_CASE		)
             self.assertIsInstance(video[0]							,     np.ndarray		)
  
        # Test not batched input
        UpperCamelCase__    :     Optional[int]        =						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
        UpperCamelCase__    :     Any        =						image_processing(SCREAMING_SNAKE_CASE							,     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       __lowercase      (	self      :     str		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     Optional[Any]        =						self.image_processing_class(**self.image_processor_dict		)
        # create random PyTorch tensors
        UpperCamelCase__    :     List[str]        =						prepare_video_inputs(self.image_processor_tester							,     equal_resolution=SCREAMING_SNAKE_CASE							,     torchify=SCREAMING_SNAKE_CASE		)
        for video in video_inputs:
             self.assertIsInstance(SCREAMING_SNAKE_CASE							,     SCREAMING_SNAKE_CASE		)
             self.assertIsInstance(video[0]							,     torch.Tensor		)
  
        # Test not batched input
        UpperCamelCase__    :     str        =						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
        UpperCamelCase__    :     Dict        =						image_processing(SCREAMING_SNAKE_CASE							,     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"],
            )							,     )
style_context: 
  
  
  
  
  
  
  def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase    )				->			str:
       return "".join(chr(ord(__lowerCAmelCase    ) + 32    ) if "A" <= char <= "Z" else char for char in word    )
  
  
  if __name__ == "__main__":
   from doctest import testmod
  
   testmod()