
"""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   __a  (      unittest.TestCase	):






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







              """simple docstring"""
              UpperCamelCase					 =		size if size is not None else {"shortest_edge": 18}
              UpperCamelCase					 =		crop_size if crop_size is not None else {"height": 18, "width": 18}

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






       def 	_SCREAMING_SNAKE_CASE       (  self :							int			)->  Tuple:







              """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  (      _lowerCAmelCase    ,     unittest.TestCase	):
       UpperCamelCase_		:					Any   =			VivitImageProcessor if is_vision_available() else None






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







              """simple docstring"""
              UpperCamelCase					 =		VivitImageProcessingTester(self			)






       @property
       def 	_SCREAMING_SNAKE_CASE       (  self :							int			)->  int:







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






       def 	_SCREAMING_SNAKE_CASE       (  self :							Tuple			)->  Optional[int]:







              """simple docstring"""
              UpperCamelCase					 =		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 	_SCREAMING_SNAKE_CASE       (  self :							Union[str, Any]			)->  Optional[Any]:







              """simple docstring"""
              UpperCamelCase					 =		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					 =		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 	_SCREAMING_SNAKE_CASE       (  self :							Dict			)->  Optional[int]:







              """simple docstring"""
              # Initialize image_processing
              UpperCamelCase					 =		self.image_processing_class(**self.image_processor_dict			)
              # create random PIL videos
              UpperCamelCase					 =		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
              UpperCamelCase					 =		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					 =		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 	_SCREAMING_SNAKE_CASE       (  self :							Dict			)->  Union[str, Any]:







              """simple docstring"""
              # Initialize image_processing
              UpperCamelCase					 =		self.image_processing_class(**self.image_processor_dict			)
              # create random numpy tensors
              UpperCamelCase					 =		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
              UpperCamelCase					 =		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					 =		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 	_SCREAMING_SNAKE_CASE       (  self :							Union[str, Any]			)->  Any:







              """simple docstring"""
              # Initialize image_processing
              UpperCamelCase					 =		self.image_processing_class(**self.image_processor_dict			)
              # create random PyTorch tensors
              UpperCamelCase					 =		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
              UpperCamelCase					 =		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					 =		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 	lowerCamelCase__			(							UpperCAmelCase_ = 4_00_00_00				)->							int:







       """simple docstring"""
       UpperCamelCase					 =		[0, 1]
       UpperCamelCase					 =		0
       while fib[i] <= n:
              fib.append(fib[i] + fib[i + 1]				)
              if fib[i + 2] > n:
                     break
              i += 1
       UpperCamelCase					 =		0
       for j in range(len(UpperCAmelCase_				) - 1				):
              if fib[j] % 2 == 0:
                     total += fib[j]

       return total


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





