




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





class     __lowercase						(  unittest.TestCase ):







   def __init__(	self      ,							UpperCamelCase      ,							UpperCamelCase=7      ,							UpperCamelCase=3      ,							UpperCamelCase=10      ,							UpperCamelCase=18      ,							UpperCamelCase=30      ,							UpperCamelCase=400      ,							UpperCamelCase=True      ,							UpperCamelCase=None      ,							UpperCamelCase=True      ,							UpperCamelCase=[0.5, 0.5, 0.5]      ,							UpperCamelCase=[0.5, 0.5, 0.5]      ,							UpperCamelCase=None      ,							)				->    str:
     __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 		UpperCamelCase__			(	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     __lowercase						(  __magic_name__       ,							unittest.TestCase ):
   _a							=      VivitImageProcessor if is_vision_available() else None







   def 		UpperCamelCase__			(	self      )				->    Any:
     __a			=					VivitImageProcessingTester(self      )







   @property
   def 		UpperCamelCase__			(	self      )				->    str:
     return self.image_processor_tester.prepare_image_processor_dict()







   def 		UpperCamelCase__			(	self      )				->    int:
     __a			=					self.image_processing_class(**self.image_processor_dict      )
     self.assertTrue(hasattr(UpperCamelCase      ,							'image_mean'      )      )
     self.assertTrue(hasattr(UpperCamelCase      ,							'image_std'      )      )
     self.assertTrue(hasattr(UpperCamelCase      ,							'do_normalize'      )      )
     self.assertTrue(hasattr(UpperCamelCase      ,							'do_resize'      )      )
     self.assertTrue(hasattr(UpperCamelCase      ,							'do_center_crop'      )      )
     self.assertTrue(hasattr(UpperCamelCase      ,							'size'      )      )







   def 		UpperCamelCase__			(	self      )				->    Optional[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 		UpperCamelCase__			(	self      )				->    Union[str, Any]:
     # 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=UpperCamelCase      )
     for video in video_inputs:
       self.assertIsInstance(UpperCamelCase      ,							UpperCamelCase      )
       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(UpperCamelCase      ,							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      )				->    Tuple:
     # 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=UpperCamelCase      ,							numpify=UpperCamelCase      )
     for video in video_inputs:
       self.assertIsInstance(UpperCamelCase      ,							UpperCamelCase      )
       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(UpperCamelCase      ,							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      )				->    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=UpperCamelCase      ,							torchify=UpperCamelCase      )
     for video in video_inputs:
       self.assertIsInstance(UpperCamelCase      ,							UpperCamelCase      )
       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(UpperCamelCase      ,							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'],
         )      ,							)









'''simple docstring'''


def 						SCREAMING_SNAKE_CASE       (      a_	:							int			):
  __a			=					0
  while num > 0:
    digit_sum += num % 10
    num //= 10
  return digit_sum


def 						SCREAMING_SNAKE_CASE       (      a_	:							int = 100			):
  __a			=					1
  __a			=					2

  for i in range(2				,					max_n + 1			):
    __a			=					pre_numerator
    __a			=					2 * i // 3 if i % 3 == 0 else 1
    __a			=					cur_numerator
    __a			=					e_cont * pre_numerator + temp

  return sum_digits(a_			)


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



